-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
main.spec
94 lines (78 loc) · 3.25 KB
/
main.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# -*- mode: python ; coding: utf-8 -*-
# HOW TO BUILD EXE USING PYINSTALLER AND THIS SPEC FILE
# If applicable, ensure you are in the correct virtual environment, and ensure that PyInstaller module is installed
# Run the following command in the terminal: python -m PyInstaller main.spec
# -------------------- SCRIPTING AND TOOLS TO MAKE IT EASIER TO BUILD --------------------
import os
import site
# Set paths
project_directory = os.getcwd() # The base directory of the project, containing the AIMemeGenerator.py file
def get_package_path(package_to_find):
site_packages_paths = site.getsitepackages()
for path in site_packages_paths:
potential_package_path = os.path.join(path, package_to_find)
if os.path.exists(potential_package_path):
return potential_package_path
return None
# Get necessary package paths
stability_sdk_path = get_package_path('stability_sdk')
# Check if icon file exists
if os.path.exists(os.path.join(project_directory, 'icon.ico')):
icon_path = os.path.join(project_directory, 'icon.ico')
else:
icon_path = None
# Check if version file exists
if os.path.exists(os.path.join(project_directory, 'VersionInfo.txt')):
version_info_file_path = os.path.join(project_directory, 'VersionInfo.txt')
else:
version_info_file_path = None
## For Testing / Debugging
print(f"\n Current Working Directory: {os.getcwd()}\n")
#input("Press Enter to continue...")
# ----------------------------------- PYINSTALLER CORE SPEC FILE CONTENTS -----------------------------------
block_cipher = None
a = Analysis(['AIMemeGenerator.py'],
pathex=[f'{project_directory}',
os.path.join(stability_sdk_path, "interfaces\\src\\tensorizer\\tensors"),
os.path.join(stability_sdk_path, "interfaces\\gooseai\\generation"),
],
binaries=[],
datas=[(stability_sdk_path, 'stability_sdk')], # Path needs to be added here. If added later even with 'a.datas+=' it will not work, will say other missing modules
hiddenimports=[
'stability_sdk',
'stability_sdk.client',
'stability_sdk.interfaces.gooseai.generation.generation_pb2',
'stability_sdk.interfaces.src.tensorizer.tensors.tensors_pb2'
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
a.datas += [('api_keys_empty.ini', '.\\assets\\api_keys_empty.ini', 'DATA')]
a.datas += [('settings_default.ini', '.\\assets\\settings_default.ini', 'DATA')]
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='AIMemeGenerator',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
icon=None,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None ,
version=version_info_file_path)