Created
August 24, 2018 12:53
-
-
Save Devligue/a314d1d1aba6ff229ed91798e01f4e01 to your computer and use it in GitHub Desktop.
Example *.spec files for PyUpdater Python app from Pipenv managed project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: python -*- | |
import os | |
import sys | |
import subprocess | |
def get_venv_path(): | |
output = subprocess.check_output(['pipenv', '--venv']) | |
return output.decode('utf-8').rstrip() | |
def get_lib_path(): | |
for path in sys.path: | |
if path.endswith('site-packages'): | |
return path | |
return os.path.join(get_venv_path(), 'lib', 'site-packages') | |
def get_project_root_dir(): | |
return os.getcwd() | |
hooks_path = os.path.join(get_lib_path(), 'pyupdater', 'hooks') | |
icon_path = '.\\relative\\path\\to\\myicon.ico' | |
resources = Tree('.\\resources', prefix='resources\\') | |
a = Analysis( | |
[os.path.join(get_project_root_dir(), 'main.py')], | |
pathex=[get_project_root_dir(), get_project_root_dir()], | |
binaries=[], | |
datas=[], | |
hiddenimports=[], | |
hookspath=[hooks_path], | |
runtime_hooks=[], | |
excludes=[], | |
win_no_prefer_redirects=False, | |
win_private_assemblies=False, | |
cipher=None) | |
pyz = PYZ( | |
a.pure, | |
a.zipped_data, | |
cipher=None) | |
exe = EXE( | |
pyz, | |
a.scripts, | |
exclude_binaries=True, | |
name='win', | |
debug=False, | |
strip=False, | |
upx=True, | |
console=False, | |
icon=icon_path) | |
coll = COLLECT( | |
exe, | |
a.binaries, | |
resources, | |
a.zipfiles, | |
a.datas, | |
strip=False, | |
upx=True, | |
name='win') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment