From 05a3d80f5af5a846309bd7e105a6dda4d3579920 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Tue, 12 Mar 2024 14:26:14 -0400 Subject: [PATCH 1/3] remove CLI command to generate spec --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index dc69a9e93..e8471c5bc 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "build:mac": "npm run build && npm run build:flask && npm run build:electron:mac", "build:linux": "npm run build && npm run build:flask && npm run build:electron:linux", "build:flask": "python -m PyInstaller nwb-guide.spec --log-level DEBUG --clean --noconfirm --distpath ./build/flask", - "build:flask:spec:base": "pyi-makespec --name nwb-guide --onedir --collect-data jsonschema_specifications --collect-all dandi --collect-all keyrings --collect-all unittest --collect-all nwbinspector --collect-all neuroconv --collect-all pynwb --collect-all hdmf --collect-all hdmf_zarr --collect-all ndx_dandi_icephys --collect-all sklearn --collect-all ci_info ./pyflask/app.py", "build:flask:spec": "npm run build:flask:spec:base && python prepare_pyinstaller_spec.py", "build:electron:win": "electron-builder build --win --publish never", "build:electron:mac": "electron-builder build --mac --publish never", From 4bdab34f2dfd461b689d3ccbe05903e9fad72b55 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Tue, 12 Mar 2024 14:26:37 -0400 Subject: [PATCH 2/3] Delete prepare_pyinstaller_spec.py --- prepare_pyinstaller_spec.py | 43 ------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 prepare_pyinstaller_spec.py diff --git a/prepare_pyinstaller_spec.py b/prepare_pyinstaller_spec.py deleted file mode 100644 index 5c0a36849..000000000 --- a/prepare_pyinstaller_spec.py +++ /dev/null @@ -1,43 +0,0 @@ -""" -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. -""" - -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, "from pathlib import Path\n") -lines.insert(3, "import scipy\n") -lines.insert(4, "from PyInstaller.utils.hooks import collect_submodules\n") -lines.insert(5, "\n") -lines.insert(6, "sys.setrecursionlimit(sys.getrecursionlimit() * 5)\n") -lines.insert(7, "\n") -lines.insert(8, "import scipy\n") - -hiddenImportIdx = lines.index("hiddenimports = []\n") - -lines[hiddenImportIdx] = ( - "hiddenimports = [ 'email_validator', *collect_submodules('scipy.special.cython_special'), *os.path.join(os.path.dirname(scipy.__file__), '.libs')]\n\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" - -# Another platform specific difference is the app.py location -app_py_line_index, app_py_line = next((index, line) for index, line in enumerate(lines) if "app.py" in line) -pyflask_start = app_py_line.find("pyflask") # Can change on certain systems -injected_app_py_line_base = app_py_line[: (pyflask_start - 1)] -injected_app_py_line = injected_app_py_line_base + "f\"{Path('pyflask') / 'app.py'}\"],\n" -lines[app_py_line_index] = injected_app_py_line - -with open(file=Path(__file__).parent / "nwb-guide.spec", mode="w") as io: - io.writelines(lines) - -print("Successfully injected recursion depth extension and json paths!") From f2d5a7006b8de8a5f3128941fcc05baac16b6616 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Tue, 12 Mar 2024 14:52:45 -0400 Subject: [PATCH 3/3] Update package.json Co-authored-by: Ryan Ly --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index e8471c5bc..63f13a7c4 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "build:mac": "npm run build && npm run build:flask && npm run build:electron:mac", "build:linux": "npm run build && npm run build:flask && npm run build:electron:linux", "build:flask": "python -m PyInstaller nwb-guide.spec --log-level DEBUG --clean --noconfirm --distpath ./build/flask", - "build:flask:spec": "npm run build:flask:spec:base && python prepare_pyinstaller_spec.py", "build:electron:win": "electron-builder build --win --publish never", "build:electron:mac": "electron-builder build --mac --publish never", "build:electron:linux": "electron-builder build --linux --publish never",