fix(build): make PyInstaller include backend modules
This commit is contained in:
38
backend/addressgen-backend.spec
Normal file
38
backend/addressgen-backend.spec
Normal file
@@ -0,0 +1,38 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['app.py'],
|
||||
pathex=['backend'],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=['p2pk', 'p2pkh', 'p2sh', 'p2tr', 'p2wpkh'],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='addressgen-backend',
|
||||
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,
|
||||
)
|
||||
@@ -9,8 +9,9 @@ from fastapi.middleware.cors import CORSMiddleware
|
||||
from pydantic import BaseModel
|
||||
|
||||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
if ROOT_DIR not in sys.path:
|
||||
sys.path.insert(0, ROOT_DIR)
|
||||
BACKEND_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
if BACKEND_DIR not in sys.path:
|
||||
sys.path.insert(0, BACKEND_DIR)
|
||||
|
||||
import p2pk
|
||||
import p2pkh
|
||||
@@ -170,7 +171,7 @@ def run():
|
||||
import uvicorn
|
||||
|
||||
port = int(os.getenv("ADDRESSGEN_PORT", "8732"))
|
||||
uvicorn.run("backend.app:app", host="127.0.0.1", port=port, log_level="info")
|
||||
uvicorn.run(app, host="127.0.0.1", port=port, log_level="info")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"dev:electron": "wait-on http://localhost:5173 && electron .",
|
||||
"dev": "concurrently -k \"npm:dev:backend\" \"npm:dev:frontend\" \"npm:dev:electron\"",
|
||||
"build:frontend": "vite build --config frontend/vite.config.js",
|
||||
"build:backend": "pyinstaller --name addressgen-backend --onefile backend/app.py --distpath backend/dist --workpath backend/build --specpath backend",
|
||||
"build:backend": "pyinstaller --name addressgen-backend --onefile backend/app.py --paths backend --hidden-import p2pk --hidden-import p2pkh --hidden-import p2sh --hidden-import p2tr --hidden-import p2wpkh --distpath backend/dist --workpath backend/build --specpath backend",
|
||||
"build": "npm run build:frontend && npm run build:backend && electron-builder --linux"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -4,3 +4,4 @@ ecdsa==0.19.0
|
||||
six==1.17.0
|
||||
fastapi==0.115.0
|
||||
uvicorn[standard]==0.30.6
|
||||
pyinstaller==6.11.0
|
||||
|
||||
Reference in New Issue
Block a user