diff --git a/package.json b/package.json index dc69a9e93..63f13a7c4 100644 --- a/package.json +++ b/package.json @@ -20,8 +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", "build:electron:linux": "electron-builder build --linux --publish never", 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!")