diff --git a/backend/addressgen-backend.spec b/backend/addressgen-backend.spec new file mode 100644 index 0000000..030c550 --- /dev/null +++ b/backend/addressgen-backend.spec @@ -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, +) diff --git a/backend/app.py b/backend/app.py index b3a5eaa..60a30bf 100644 --- a/backend/app.py +++ b/backend/app.py @@ -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__": diff --git a/package.json b/package.json index cc229eb..01a5b89 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/requirements.txt b/requirements.txt index 634f5ea..5aa1a6e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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