-
Notifications
You must be signed in to change notification settings - Fork 610
/
pyinstaller.spec
87 lines (80 loc) · 2.46 KB
/
pyinstaller.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
import os
import user_agent
import subprocess
from PyInstaller.utils.win32.versioninfo import VSVersionInfo, FixedFileInfo, StringFileInfo, StringTable, StringStruct, VarFileInfo, VarStruct
a = Analysis(
['start_ofd.py'],
pathex=[SPECPATH],
binaries=[('extras/OFLogin/geckodriver.exe', '.')], # https://github.com/mozilla/geckodriver/releases/tag/v0.27.0
datas=[
(os.path.join(os.path.dirname(user_agent.__file__), 'data', '*'), 'user_agent/data'),
('database/databases', 'database/databases')
],
hiddenimports=['logging.config'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=None,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
def git(*args):
args = ['git', '-C', SPECPATH] + list(args)
environ = dict(os.environ)
environ['LC_ALL'] = 'C.UTF-8'
return subprocess.run(
args=args,
stdout=subprocess.PIPE,
env=environ,
check=True,
encoding='utf-8',
errors='replace').stdout.strip()
major = 8
minor = 0
patch = 0
build = int(git('rev-list', 'HEAD', '--count'))
commit = git('rev-parse', '--short', 'HEAD')
branch = git('rev-parse', '--abbrev-ref', 'HEAD')
version = VSVersionInfo(
ffi=FixedFileInfo(
filevers=(major, minor, patch, build),
prodvers=(major, minor, patch, 0),
mask=0x3f,
flags=0x0,
OS=0x40004,
fileType=0x1,
subtype=0x0,
date=(0, 0)
),
kids=[
StringFileInfo([
StringTable(
'040904B0',
[
StringStruct('FileDescription', 'Ultima Scraper'),
StringStruct('FileVersion', '{}.{}.{}.{}'.format(major, minor, patch, build)),
StringStruct('LegalCopyright', 'GPLv3'),
StringStruct('ProductName', 'Ultima Scraper'),
StringStruct('ProductVersion', '{}.{}.{}+{}@{}'.format(major, minor, patch, commit, branch))
])
]),
VarFileInfo([VarStruct('Translation', [1033, 1200])])
]
)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='UltimaScraper-{}.{}.{}'.format(major, minor, patch),
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
icon='docs/assets/img/icon.ico',
version=version)