82 lines
1.7 KiB
Python
82 lines
1.7 KiB
Python
# -*- mode: python ; coding: utf-8 -*-
|
|
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
spec_dir = Path(SPECPATH)
|
|
|
|
|
|
def git_build_ref():
|
|
try:
|
|
tag = subprocess.check_output(
|
|
['git', 'describe', '--tags', '--exact-match', 'HEAD'],
|
|
cwd=spec_dir,
|
|
stderr=subprocess.DEVNULL,
|
|
text=True,
|
|
).strip()
|
|
if tag:
|
|
return tag
|
|
except (OSError, subprocess.CalledProcessError):
|
|
pass
|
|
try:
|
|
commit = subprocess.check_output(
|
|
['git', 'rev-parse', '--short', 'HEAD'],
|
|
cwd=spec_dir,
|
|
stderr=subprocess.DEVNULL,
|
|
text=True,
|
|
).strip()
|
|
if commit:
|
|
return commit
|
|
except (OSError, subprocess.CalledProcessError):
|
|
pass
|
|
return 'untagged'
|
|
|
|
|
|
app_name = f'LEDMapper-{git_build_ref()}'
|
|
|
|
|
|
a = Analysis(
|
|
[str(spec_dir / 'main.py')],
|
|
pathex=[str(spec_dir), str(spec_dir.parent)],
|
|
binaries=[],
|
|
datas=[],
|
|
hiddenimports=[
|
|
'canvas',
|
|
'icons',
|
|
'main_window',
|
|
'models',
|
|
'panel_mapping_generator',
|
|
'unfolding',
|
|
],
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
runtime_hooks=[],
|
|
excludes=[],
|
|
noarchive=False,
|
|
optimize=0,
|
|
)
|
|
pyz = PYZ(a.pure)
|
|
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
a.binaries,
|
|
a.datas,
|
|
[],
|
|
name=app_name,
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
upx_exclude=[],
|
|
runtime_tmpdir=None,
|
|
console=False,
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
icon=str(spec_dir / 'assets' / 'ledmapper.ico'),
|
|
)
|