Skip to content

Instantly share code, notes, and snippets.

@samclane
Created June 9, 2018 20:25
Show Gist options
  • Save samclane/cbf44116a3c1e1a9c5e11c5e932360d3 to your computer and use it in GitHub Desktop.
Save samclane/cbf44116a3c1e1a9c5e11c5e932360d3 to your computer and use it in GitHub Desktop.
Full spec file for main binary
# -*- mode: python -*-
import datetime
bd = datetime.datetime.now().isoformat()
auth = "Sawyer McLane"
vers = "1.3.4"
is_debug = False
# Write version info into _constants.py resource file
with open('_constants.py', 'w') as f:
f.write("VERSION = \"{}\"\n".format(vers))
f.write("BUILD_DATE = \"{}\"\n".format(bd))
f.write("AUTHOR = \"{}\"\n".format(auth))
f.write("DEBUGGING = {}".format(str(is_debug)))
# Write version info into default config file
with open('default.ini', 'r') as f:
initdata = f.readlines()
initdata[-1] = "builddate = {}\n".format(bd)
initdata[-2] = "author = {}\n".format(auth)
initdata[-3] = "version = {}\n".format(vers)
with open('default.ini', 'w') as f:
f.writelines(initdata)
block_cipher = None
a = Analysis(['gui.pyw', 'color_thread.py', 'audio.py', 'settings.py', 'SysTrayIcon.py', 'utils.py', '_constants.py'],
pathex=['C:\\Users\\SawyerPC\\PycharmProjects\\LIFX_Toys'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
for d in a.datas:
if 'pyconfig' in d[0]:
a.datas.remove(d)
break
a.datas += [('res//splash_vector_png.png', 'C:\\Users\\SawyerPC\\PycharmProjects\\LIFX_Toys\\res\\splash_vector_png.png', 'Data')]
a.datas += [('res//icon_vector_9fv_icon.ico', 'C:\\Users\\SawyerPC\\PycharmProjects\\LIFX_Toys\\res\\icon_vector_9fv_icon.ico', 'Data')]
a.datas += [('res//lightbulb.png', 'C:\\Users\\SawyerPC\\PycharmProjects\\LIFX_Toys\\res\\lightbulb.png', 'Data')]
a.datas += [('default.ini', 'C:\\Users\\SawyerPC\\PycharmProjects\\LIFX_Toys\\default.ini', '.')]
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='LIFX-Control-Panel',
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=is_debug,
icon='icons//icon_vector_9fv_icon.ico')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment