OLD | NEW |
1 # PyInstaller spec, run "pyinstaller runserver.spec" from repository root to bui
ld | 1 # PyInstaller spec, run "pyinstaller runserver.spec" from repository root to bui
ld |
2 | 2 |
3 # Hidden imports are supposed to be analyzed recursively. However, due to | 3 # Hidden imports are supposed to be analyzed recursively. However, due to |
4 # a bug in PyInstaller imports from inside hidden modules aren't considered. | 4 # a bug in PyInstaller imports from inside hidden modules aren't considered. |
5 # https://github.com/pyinstaller/pyinstaller/issues/1086 | 5 # https://github.com/pyinstaller/pyinstaller/issues/1086 |
6 def AnalysisWithHiddenImportsWorkaround(scripts, **kwargs): | 6 def AnalysisWithHiddenImportsWorkaround(scripts, **kwargs): |
7 import os | 7 import os |
8 | 8 |
9 filename = os.path.join(WORKPATH, '_hidden_imports.py') | 9 filename = os.path.join(WORKPATH, '_hidden_imports.py') |
10 with open(filename, 'wb') as file: | 10 with open(filename, 'wb') as file: |
11 for module in kwargs.pop('hiddenimports'): | 11 for module in kwargs.pop('hiddenimports'): |
12 print >>file, 'import ' + module | 12 print >>file, 'import ' + module |
13 | 13 |
14 a = Analysis([filename] + scripts, **kwargs) | 14 a = Analysis([filename] + scripts, **kwargs) |
15 a.scripts -= [('_hidden_imports', None, None)] | 15 a.scripts -= [('_hidden_imports', None, None)] |
16 return a | 16 return a |
17 | 17 |
18 a = AnalysisWithHiddenImportsWorkaround( | 18 a = AnalysisWithHiddenImportsWorkaround( |
19 ['cms/bin/test_server.py'], | 19 ['cms/bin/test_server.py'], |
20 pathex=['.'], | 20 pathex=['.'], |
21 hiddenimports=[ | 21 hiddenimports=[ |
22 'markdown.extensions.attr_list', | 22 'markdown.extensions.attr_list', |
23 | 23 |
24 # Used by globals/get_browser_versions.py in web.adblockplus.org | 24 # Used by globals/get_browser_versions.py in web.adblockplus.org |
25 'xml.dom.minidom', | 25 'xml.dom.minidom', |
26 ], | 26 ], |
27 excludes=[ | 27 excludes=[ |
28 'distutils', | 28 'distutils', |
29 'doctest', | 29 'doctest', |
30 'ssl', | |
31 '_ssl', | |
32 'werkzeug', | 30 'werkzeug', |
33 | 31 |
34 # Mac-specific | 32 # Mac-specific |
35 'Carbon', | 33 'Carbon', |
36 'Finder', | 34 'Finder', |
37 'StdSuites', | 35 'StdSuites', |
38 ], | 36 ], |
39 ) | 37 ) |
40 | 38 |
41 pyz = PYZ(a.pure) | 39 pyz = PYZ(a.pure) |
42 | 40 |
43 exe = EXE( | 41 exe = EXE( |
44 pyz, | 42 pyz, |
45 a.scripts, | 43 a.scripts, |
46 a.binaries, | 44 a.binaries, |
47 a.zipfiles, | 45 a.zipfiles, |
48 a.datas, | 46 a.datas, |
49 name='runserver', | 47 name='runserver', |
50 debug=False, | 48 debug=False, |
51 strip=None, | 49 strip=None, |
52 upx=False, | 50 upx=False, |
53 console=True | 51 console=True |
54 ) | 52 ) |
OLD | NEW |