Skip to content

Commit

Permalink
Merge pull request #46 from fhilipecrash/build/generate-python-exe-wi…
Browse files Browse the repository at this point in the history
…th-cx-freeze

Build/change pyinstaller with cx_freeze
  • Loading branch information
Hydra authored Apr 19, 2024
2 parents 54766e2 + 3a99be9 commit ae426cf
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: [
Expand Down
11 changes: 11 additions & 0 deletions hydra-launcher.desktop
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
libtorrent
pyinstaller
cx_Freeze
cx_Logging; sys_platform == 'win32'
lief; sys_platform == 'win32'
pywin32; sys_platform == 'win32'
16 changes: 16 additions & 0 deletions torrent-client/setup.py
Original file line number Diff line number Diff line change
@@ -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")]
)

0 comments on commit ae426cf

Please sign in to comment.