Files

86 lines
2.3 KiB
RPMSpec

# -*- mode: python ; coding: utf-8 -*-
from pathlib import Path
project_root = Path(SPECPATH)
datas = [
(str(project_root / "icon_glass.ico"), "."),
(str(project_root / "packaging" / "sample.md"), "."),
(str(project_root / "docs"), "docs"),
(str(project_root / "media" / "screenshot.png"), "media"),
(str(project_root / "mdhelper" / "resources"), "mdhelper/resources"),
(str(project_root / "vendor" / "pandoc"), "vendor/pandoc"),
]
a = Analysis(
["run_mdhelper.py"],
pathex=[str(project_root)],
binaries=[],
datas=datas,
hiddenimports=[],
hookspath=[str(project_root / "hooks")],
hooksconfig={},
runtime_hooks=[],
excludes=["PIL"],
noarchive=False,
optimize=0,
)
def keep_runtime_data(entry):
target = str(entry[0]).replace("/", "\\").lower()
if ".debug." in target or "qtwebengine_devtools_resources" in target:
return False
if "\\plugins\\qmltooling\\" in target:
return False
if "\\translations\\" in target:
filename = Path(target).name
return any(locale in filename for locale in ("zh_cn", "zh-cn", "en_us", "en-us", "en_gb", "en-gb", "_en."))
return True
def keep_runtime_binary(entry):
source = str(entry[1]).replace("/", "\\").lower()
# PyInstaller resolves transitive DLLs through PATH. Codex adds bundled
# Poppler/libheif directories there, whose ICU/UCRT DLLs are incompatible
# with the Windows system libraries expected by PySide6.
return "\\codex-runtimes\\" not in source
a.binaries = [entry for entry in a.binaries if keep_runtime_binary(entry)]
a.datas = [entry for entry in a.datas if keep_runtime_data(entry)]
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name="MDHelper",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
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(project_root / "icon_glass.ico"),
)
# Install this directory once; ordinary launches no longer extract Qt/Pandoc.
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=False,
name="MDHelper",
)