refactor: 统一构建产物输出目录
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
project_root = Path.cwd()
|
||||
onefile = os.environ.get("CAPAREPORT_ONEFILE") == "1"
|
||||
|
||||
hiddenimports = [
|
||||
"uvicorn.logging",
|
||||
"uvicorn.loops.auto",
|
||||
"uvicorn.loops.asyncio",
|
||||
"uvicorn.protocols.http.auto",
|
||||
"uvicorn.protocols.http.h11_impl",
|
||||
"uvicorn.protocols.websockets.auto",
|
||||
"uvicorn.protocols.websockets.websockets_impl",
|
||||
"uvicorn.lifespan.on",
|
||||
"pymysql",
|
||||
"paramiko",
|
||||
"openpyxl",
|
||||
"chardet",
|
||||
]
|
||||
|
||||
excludes = [
|
||||
"pytest",
|
||||
"pandas.tests",
|
||||
"numpy.tests",
|
||||
"openpyxl.tests",
|
||||
"matplotlib",
|
||||
"IPython",
|
||||
"notebook",
|
||||
"tkinter",
|
||||
]
|
||||
|
||||
a = Analysis(
|
||||
[str(project_root / "app" / "main.py")],
|
||||
pathex=[str(project_root)],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=hiddenimports,
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=excludes,
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
if onefile:
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
exclude_binaries=False,
|
||||
name="capareport-server",
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
else:
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
[],
|
||||
exclude_binaries=True,
|
||||
name="capareport-server",
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
|
||||
coll = COLLECT(
|
||||
exe,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
name="capareport-server",
|
||||
)
|
||||
Reference in New Issue
Block a user