forked from tahoe-lafs/tahoe-lafs
-
Notifications
You must be signed in to change notification settings - Fork 4
/
pyinstaller.spec
116 lines (101 loc) · 2.47 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# -*- mode: python -*-
from distutils.sysconfig import get_python_lib
import hashlib
import os
import platform
import shutil
import struct
import sys
try:
import allmydata
del allmydata
except ImportError:
sys.exit("Please run inside a virtualenv with Tahoe-LAFS installed.")
options = [('u', None, 'OPTION')] # Unbuffered stdio
added_files = [
('COPYING.*', '.'),
('CREDITS', '.'),
('relnotes.txt', '.'),
('src/allmydata/web/*.xhtml', 'allmydata/web'),
('src/allmydata/web/static/*', 'allmydata/web/static'),
('src/allmydata/web/static/css/*', 'allmydata/web/static/css'),
('src/allmydata/web/static/img/*.png', 'allmydata/web/static/img')]
hidden_imports = [
'__builtin__',
'allmydata.client',
'allmydata.introducer',
'allmydata.stats',
'base64',
'cffi',
'charset_normalizer.md__mypyc',
'collections',
'commands',
'Crypto',
'functools',
'future.backports.misc',
'itertools',
'math',
'packaging.specifiers',
're',
'reprlib',
'six.moves.html_parser',
'subprocess',
'UserDict',
'UserList',
'UserString',
'yaml',
'zfec',
]
a = Analysis(
['static/tahoe.py'],
pathex=[],
binaries=None,
datas=added_files,
hiddenimports=hidden_imports,
hookspath=[],
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,
options,
exclude_binaries=True,
name='tahoe',
debug=False,
strip=False,
upx=False,
console=True)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=False,
name='Tahoe-LAFS')
print("Creating archive...")
platform_tag = platform.system().replace('Darwin', 'MacOS')
bitness_tag = str(struct.calcsize('P') * 8) + 'bit'
archive_name = 'Tahoe-LAFS-{}-{}'.format(platform_tag, bitness_tag)
if sys.platform == 'win32':
archive_format = 'zip'
archive_suffix = '.zip'
else:
archive_format = 'gztar'
archive_suffix = '.tar.gz'
base_name = os.path.join('dist', archive_name)
shutil.make_archive(base_name, archive_format, 'dist', 'Tahoe-LAFS')
print("Hashing (SHA256)...")
archive_path = base_name + archive_suffix
hasher = hashlib.sha256()
with open(archive_path, 'rb') as f:
for block in iter(lambda: f.read(4096), b''):
hasher.update(block)
print("{} {}".format(hasher.hexdigest(), archive_path))