From d04af753ce7652ddf839a83983817bd5c8a0fb3b Mon Sep 17 00:00:00 2001 From: Fhilipe Coelho Date: Fri, 19 Apr 2024 15:03:41 -0300 Subject: [PATCH 1/6] build: use cx freeze instead pyinstaller --- torrent-client/setup.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 torrent-client/setup.py diff --git a/torrent-client/setup.py b/torrent-client/setup.py new file mode 100644 index 00000000..e098ec80 --- /dev/null +++ b/torrent-client/setup.py @@ -0,0 +1,16 @@ +from cx_Freeze import setup, Executable + +# Dependencies are automatically detected, but it might need fine tuning. +build_exe_options = { + "packages": ["libtorrent"], + "build_exe": "resources/dist/hydra-download-manager", + "include_msvcr": True +} + +setup( + name="hydra-download-manager", + version="0.1", + description="Hydra Torrent Client", + options={"build_exe": build_exe_options}, + executables=[Executable("torrent-client/main.py", target_name="hydra-download-manager")] +) From f8228bfde02c590e0dfab348df00bf99b0bfb120 Mon Sep 17 00:00:00 2001 From: Fhilipe Coelho Date: Fri, 19 Apr 2024 15:14:44 -0300 Subject: [PATCH 2/6] build(linux): add .desktop config --- forge.config.ts | 20 ++++++++++++-------- hydra-launcher.desktop | 11 +++++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 hydra-launcher.desktop diff --git a/forge.config.ts b/forge.config.ts index 3bc8bf23..21718764 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -13,6 +13,16 @@ import { ElectronegativityPlugin } from "@electron-forge/plugin-electronegativit import { mainConfig } from "./webpack.main.config"; import { rendererConfig } from "./webpack.renderer.config"; +const linuxPkgConfig = { + mimeType: ["x-scheme-handler/hydralauncher"], + bin: "./Hydra", + desktopTemplate: "./hydra-launcher.desktop", + icon: "images/icon.png", + genericName: "Games Launcher", + name: "hydra-launcher", + productName: "Hydra" +}; + const config: ForgeConfig = { packagerConfig: { asar: true, @@ -40,16 +50,10 @@ const config: ForgeConfig = { }), new MakerZIP({}, ["darwin", "linux"]), new MakerRpm({ - options: { - mimeType: ["x-scheme-handler/hydralauncher"], - bin: "./Hydra", - }, + options: linuxPkgConfig }), new MakerDeb({ - options: { - mimeType: ["x-scheme-handler/hydralauncher"], - bin: "./Hydra", - }, + options: linuxPkgConfig }), ], publishers: [ diff --git a/hydra-launcher.desktop b/hydra-launcher.desktop new file mode 100644 index 00000000..e9e10e91 --- /dev/null +++ b/hydra-launcher.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Hydra +Comment=No bullshit. Just play. +GenericName=Games Launcher +Exec=hydra-launcher %U +Icon=hydra-launcher +Type=Application +StartupNotify=true +Categories=GNOME;GTK;Utility; +MimeType=x-scheme-handler/hydralauncher; +StartupWMClass=Hydra From ebd06545956fd83ea4cdbf53f983cf166cae0459 Mon Sep 17 00:00:00 2001 From: Fhilipe Coelho Date: Fri, 19 Apr 2024 15:22:44 -0300 Subject: [PATCH 3/6] build: add windows deps in requirements.txt --- requirements.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b2778d60..6cee730a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ libtorrent -pyinstaller +cx_Freeze +cx_Logging; sys_platform == 'win32' +lief; sys_platform == 'win32' pywin32; sys_platform == 'win32' From d953ae9c47edf834a192efc9c72ecd6ef6de5a9b Mon Sep 17 00:00:00 2001 From: Fhilipe Coelho Date: Fri, 19 Apr 2024 15:36:29 -0300 Subject: [PATCH 4/6] docs: change build bittorrent client command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c2a5d9b..a737756e 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ yarn start Build the bittorrent client by using this command: ```bash -pyinstaller torrent-client/main.py --distpath resources/dist --icon=images/icon.ico -n hydra-download-manager +python torrent-client/setup.py build ``` ### Build the Electron application From 57922eaff04b8ebe3a005b771db5ce458fd4235f Mon Sep 17 00:00:00 2001 From: Fhilipe Coelho Date: Fri, 19 Apr 2024 16:35:47 -0300 Subject: [PATCH 5/6] build: change build torrent command in pipeline --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fff7e9c2..459af536 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,7 +48,7 @@ jobs: run: pip install -r requirements.txt - name: Build with pyinstaller - run: pyinstaller torrent-client/main.py --distpath resources/dist --icon=images/icon.ico -n hydra-download-manager + run: python torrent-client/setup.py build - name: Publish run: yarn run publish From 761801e5d26a0c159097c74a74344f18e02b37be Mon Sep 17 00:00:00 2001 From: Fhilipe Coelho Date: Fri, 19 Apr 2024 16:42:09 -0300 Subject: [PATCH 6/6] build: change build torrent task name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 459af536..d515769b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,7 +47,7 @@ jobs: - name: Install dependencies run: pip install -r requirements.txt - - name: Build with pyinstaller + - name: Build with cx_Freeze run: python torrent-client/setup.py build - name: Publish