build: add portable single-file EXE to the build

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-21 13:31:02 +02:00
1 parent 735585c579
commit c42cedd655
3 files changed
+34 -18

No files matched your search

+21 -15
View File
@@ -2,10 +2,16 @@
# Build: python -m PyInstaller --noconfirm --clean NetBoxSynchronizer.spec
# Produces a one-folder build in dist/NetBoxSynchronizer that the Inno Setup
# installer (installer/NetBoxSynchronizer.iss) packages.
#
# Portable: python -m PyInstaller --noconfirm --clean NetBoxSynchronizer.spec -- --portable
# Produces a single self-extracting "NetBox VM Import.exe".
import re
import sys
from pathlib import Path
PORTABLE = "--portable" in sys.argv
from PyInstaller.utils.win32.versioninfo import (
FixedFileInfo,
StringFileInfo,
@@ -66,12 +72,7 @@ a.datas = [
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name="NetBoxSynchronizer",
EXE_OPTIONS = dict(
debug=False,
bootloader_ignore_signals=False,
strip=False,
@@ -86,12 +87,17 @@ exe = EXE(
version=version_info,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name="NetBoxSynchronizer",
)
if PORTABLE:
exe = EXE(pyz, a.scripts, a.binaries, a.datas, [], name="NetBox VM Import", upx_exclude=[],
runtime_tmpdir=None, **EXE_OPTIONS)
else:
exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name="NetBoxSynchronizer", **EXE_OPTIONS)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name="NetBoxSynchronizer",
)