-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swap to .spec files for PyInstaller #365
Merged
Merged
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e396301
Update package.json
CodyCBakerPhD d5812fb
fix alterations
CodyCBakerPhD 9e83ca7
restore other
CodyCBakerPhD cb98081
add spec file for windows
CodyCBakerPhD 0e1e839
new commands
CodyCBakerPhD 3ba98f6
Merge branch 'main' into use_pyinstaller_spec_files_per_platform
CodyCBakerPhD 610de05
add other renames
CodyCBakerPhD cf69119
add other build calls
CodyCBakerPhD eb98231
Merge branch 'use_pyinstaller_spec_files_per_platform' of https://git…
CodyCBakerPhD a807e65
propagate to top level
CodyCBakerPhD 69efd18
forgot hidden import
CodyCBakerPhD 1f97066
update spec file, duh
CodyCBakerPhD b3a68d6
re-add recursion limit hack, duh
CodyCBakerPhD 41f220d
Merge branch 'main' into use_pyinstaller_spec_files_per_platform
CodyCBakerPhD 6e1e1ef
re-add ndx-icephys
CodyCBakerPhD bb32343
Merge branch 'main' into use_pyinstaller_spec_files_per_platform
CodyCBakerPhD 7c1c3c0
simpify cross-platform; update workflows
CodyCBakerPhD 9d870f7
Merge branch 'use_pyinstaller_spec_files_per_platform' of https://git…
CodyCBakerPhD a9ddea5
simplify python
CodyCBakerPhD 1d5579b
modify spec to be platform indepedent
CodyCBakerPhD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,6 @@ semantic.json | |
build/ | ||
yarn.lock | ||
|
||
*.spec | ||
|
||
*.pyc | ||
src/.DS_Store | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
import sys | ||
sys.setrecursionlimit(sys.getrecursionlimit() * 5) | ||
|
||
from PyInstaller.utils.hooks import collect_data_files | ||
from PyInstaller.utils.hooks import collect_all | ||
|
||
datas = [('./paths.config.json', '.'), ('./package.json', '.')] | ||
binaries = [] | ||
hiddenimports = ['scipy._distributor_init', 'scipy._lib.messagestream', 'scipy._lib._ccallback', 'scipy._lib._testutils', 'email_validator'] | ||
datas += collect_data_files('jsonschema_specifications') | ||
tmp_ret = collect_all('nwbinspector') | ||
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2] | ||
tmp_ret = collect_all('neuroconv') | ||
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2] | ||
tmp_ret = collect_all('pynwb') | ||
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2] | ||
tmp_ret = collect_all('hdmf') | ||
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2] | ||
tmp_ret = collect_all('ndx_dandi_icephys') | ||
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2] | ||
tmp_ret = collect_all('ci_info') | ||
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2] | ||
|
||
|
||
block_cipher = None | ||
|
||
|
||
a = Analysis( | ||
['pyflask\\app.py'], | ||
pathex=[], | ||
binaries=binaries, | ||
datas=datas, | ||
hiddenimports=hiddenimports, | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False, | ||
) | ||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name='nwb-guide', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=True, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name='nwb-guide', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Calling `pyi-makespec` regenerates the base spec file, but we need to extend the recursion limit. | ||
|
||
This script is run automatically as a part of `npm run build:flask:spec` after the `pyi-makespec` call. | ||
""" | ||
|
||
|
||
def test(): | ||
from pathlib import Path | ||
|
||
with open(file=Path(__file__).parent / "nwb-guide.spec", mode="r") as io: | ||
lines = io.readlines() | ||
|
||
lines.insert(1, "import sys\n") | ||
lines.insert(2, "sys.setrecursionlimit(sys.getrecursionlimit() * 5)\n") | ||
lines.insert(3, "\n") | ||
|
||
# Originally this was a separate `npm` command per platform to account for CLI syntax differences between ; and : | ||
# The spec file is, however, the same across platforms | ||
data_line_index = lines.index("datas = []\n") | ||
lines[data_line_index] = "datas = [('./paths.config.json', '.'), ('./package.json', '.')]\n" | ||
|
||
with open(file=Path(__file__).parent / "nwb-guide.spec", mode="w") as io: | ||
io.writelines(lines) | ||
|
||
print("Sucessfully injected recursion depth extension and json paths!") | ||
|
||
|
||
if __name__ == "__main__": | ||
test() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be consistent with our environment files. Technically doesn't matter b/c the environment files override it, but still