Skip to content

Commit

Permalink
unlock dependencies; fix pyinstaller path search
Browse files Browse the repository at this point in the history
  • Loading branch information
bri3d committed Dec 14, 2024
1 parent 5249166 commit 7dbe525
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 52 deletions.
74 changes: 34 additions & 40 deletions VW_Flash_GUI.spec
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None
a = Analysis(
['VW_Flash_GUI.py'],
pathex=[],
binaries=[('lib/lzss/lzss.exe', 'lib/lzss/')],
datas=[('data', 'data'), ('logging.conf', '.'), ('logs', 'logs')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)


a = Analysis(['VW_Flash_GUI.py'],
pathex=[],
binaries=[],
datas=[('logging.conf', '.'), ('data', 'data'), ('docs', 'docs'), ('lib/lzss/lzss.exe','lib/lzss/.'),('logs', 'logs')],
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='VW_Flash_GUI',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=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='VW_Flash_GUI')
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='VW_Flash_GUI',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
5 changes: 1 addition & 4 deletions lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,10 @@ def block_to_number(self, blockname: str) -> int:


def internal_path(*path_parts) -> str:
__location__ = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
if sys.platform == "win32":
__location__ = os.path.dirname(os.path.abspath(sys.argv[0]))
return os.path.join(__location__, *path_parts)
else:
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__))
)
return os.path.join(__location__, os.path.pardir, *path_parts)


Expand Down
13 changes: 6 additions & 7 deletions lib/lzss_helper.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import os, sys
import subprocess

if sys.platform == "win32":
libdir = os.path.dirname(os.path.abspath(sys.argv[0]))
else:
libdir = os.path.dirname(os.path.abspath(__file__))
from .resource_helper import resource_path


def lzss_compress(input_data: bytes, skip_padding=False, exact_padding=False) -> bytes:
if sys.platform == "win32":
lzssPath = "/lib/lzss/lzss.exe"
lzss_name = "lzss.exe"
else:
lzssPath = "/lzss/lzss"
lzss_name = "lzss"

lzss_command_line = [libdir + lzssPath, "-s"]
lzss_path = resource_path("lib/lzss/" + lzss_name)

lzss_command_line = [lzss_path, "-s"]

# Don't pad up to the AES blocksize. Used for DSG
if skip_padding:
Expand Down
6 changes: 6 additions & 0 deletions lib/resource_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os
import sys

def resource_path(relative_path):
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ can-isotp
sa2-seed-key
tqdm
pycryptodome
wxpython==4.1.1
wxpython
python-can
pyyaml
pyserial

0 comments on commit 7dbe525

Please sign in to comment.