Merge pull request #46 from fhilipecrash/build/generate-python-exe-with-cx-freeze

Build/change pyinstaller with cx_freeze
This commit is contained in:
Hydra 2024-04-19 16:44:05 -03:00 committed by GitHub
commit f8d6375126
6 changed files with 45 additions and 12 deletions

View File

@ -47,8 +47,8 @@ jobs:
- name: Install dependencies
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
- name: Build with cx_Freeze
run: python torrent-client/setup.py build
- name: Publish
run: yarn run publish

View File

@ -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

View File

@ -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: [

11
hydra-launcher.desktop Normal file
View File

@ -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

View File

@ -1,3 +1,5 @@
libtorrent
pyinstaller
cx_Freeze
cx_Logging; sys_platform == 'win32'
lief; sys_platform == 'win32'
pywin32; sys_platform == 'win32'

16
torrent-client/setup.py Normal file
View File

@ -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")]
)