diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index c51d91a..4a073f6 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -1,5 +1,4 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python +# This workflow will install Python dependencies and then build NUSGet for all platforms name: Python application @@ -30,8 +29,7 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt - name: Build Package - run: | - make linux + run: make all - name: Prepare Package for Upload run: | mv NUSGet ~/NUSGet @@ -41,7 +39,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: ~/NUSGet.tar - name: NUSGet-linux-bin + name: NUSGet-Linux-bin build-macos-x86: @@ -58,9 +56,7 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt - name: Build Package - run: | - python build_translations.py - python -m nuitka --show-progress --include-data-dir=data=data --include-data-dir=resources=resources --assume-yes-for-downloads --standalone --plugin-enable=pyside6 NUSGet.py --macos-create-app-bundle --macos-app-icon=resources/icon.png --macos-target-arch=x86_64 + run: ARCH_FLAGS=--macos-target-arch=x86_64 make all - name: Prepare Package for Upload run: | mv NUSGet.app ~/NUSGet.app @@ -70,7 +66,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: ~/NUSGet.tar - name: NUSGet-macos-x86-bin + name: NUSGet-macOS-x86_64-bin build-macos-arm64: @@ -87,9 +83,7 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt - name: Build Package - run: | - python build_translations.py - python -m nuitka --show-progress --include-data-dir=data=data --include-data-dir=resources=resources --assume-yes-for-downloads --standalone --plugin-enable=pyside6 NUSGet.py --macos-create-app-bundle --macos-app-icon=resources/icon.png --macos-target-arch=arm64 + run: ARCH_FLAGS=--macos-target-arch=arm64 make all - name: Prepare Package for Upload run: | mv NUSGet.app ~/NUSGet.app @@ -99,7 +93,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: ~/NUSGet.tar - name: NUSGet-macos-arm64-bin + name: NUSGet-macOS-arm64-bin build-windows: @@ -118,17 +112,14 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt - name: Build Package - run: | - python build_translations.py - python -m nuitka --show-progress --include-data-dir=data=data --include-data-dir=resources=resources --assume-yes-for-downloads --onefile --windows-icon-from-ico=resources/icon.png --plugin-enable=pyside6 NUSGet.py --windows-console-mode=disable + run: .\Build.ps1 - name: Upload Package uses: actions/upload-artifact@v4 with: path: D:\a\NUSGet\NUSGet\NUSGet.dist - name: NUSGet-windows-bin + name: NUSGet-Windows-bin - name: Upload Onefile Package uses: actions/upload-artifact@v4 with: path: D:\a\NUSGet\NUSGet\NUSGet.exe - name: NUSGet-windows-onefile-bin - + name: NUSGet-Windows-onefile-bin diff --git a/Build.ps1 b/Build.ps1 new file mode 100644 index 0000000..54edcbf --- /dev/null +++ b/Build.ps1 @@ -0,0 +1,33 @@ +# Build.ps1 for NUSGet + +# Default option is to run build, like a Makefile +param( + [string]$Task = "build" +) + +$buildNUSGet = { + Write-Host "Building NUSGet..." + python build_translations.py + python -m nuitka --show-progress --assume-yes-for-downloads NUSGet.py +} + +$cleanNUSGet = { + Write-Host "Cleaning..." + Remove-Item -Recurse -Force NUSGet.exe, ./NUSGet.build/, ./NUSGet.dist/, ./NUSGet.onefile-build/ +} + +switch ($Task.ToLower()) { + "build" { + & $buildNUSGet + break + } + "clean" { + & $cleanNUSGet + break + } + default { + Write-Host "Unknown task: $Task" -ForegroundColor Red + Write-Host "Available tasks: build, clean" + break + } +} diff --git a/Makefile b/Makefile index f5b0a22..fa3ba98 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ CC=python -m nuitka +ARCH_FLAGS?= -linux: +all: python build_translations.py - $(CC) --show-progress --include-data-dir=data=data --include-data-dir=resources=resources --assume-yes-for-downloads --onefile --plugin-enable=pyside6 NUSGet.py -o NUSGet + $(CC) --show-progress --assume-yes-for-downloads NUSGet.py $(ARCH_FLAGS) -o NUSGet -linux-install: +install: install -d /opt/NUSGet install NUSGet /opt/NUSGet/ install ./packaging/icon.png /opt/NUSGet/NUSGet.png diff --git a/NUSGet.py b/NUSGet.py index fe90675..8ea0b16 100644 --- a/NUSGet.py +++ b/NUSGet.py @@ -1,6 +1,23 @@ # "NUSGet.py", licensed under the MIT license # Copyright 2024 NinjaCheetah +# Nuitka options. These determine compilation settings based on the current OS. +# nuitka-project-if: {OS} == "Darwin": +# nuitka-project: --standalone +# nuitka-project: --macos-create-app-bundle +# nuitka-project: --macos-app-icon={MAIN_DIRECTORY}/resources/icon.png +# nuitka-project-if: {OS} == "Windows": +# nuitka-project: --onefile +# nuitka-project: --windows-icon-from-ico={MAIN_DIRECTORY}/resources/icon.png +# nuitka-project: --windows-console-mode=disable +# nuitka-project-else: +# nuitka-project: --onefile + +# These are standard options that are needed on all platforms. +# nuitka-project: --plugin-enable=pyside6 +# nuitka-project: --include-data-dir={MAIN_DIRECTORY}/data=data +# nuitka-project: --include-data-dir={MAIN_DIRECTORY}/resources=resources + import os import sys import json diff --git a/README.md b/README.md index 4b33369..2b11e9e 100644 --- a/README.md +++ b/README.md @@ -33,48 +33,43 @@ For basic usage on all platforms, you can download the latest release for your o ## Building ### System Requirements -- **Windows:** Python 3.11 (Requires Windows 8.1 or later) -- **Linux:** Python 3.11 -- **macOS:** Python 3.11 (Requires macOS 10.9 or later, however macOS 11.0 or later may be required for library support) +- **Windows:** Python 3.12 (Requires Windows 8.1 or later) +- **Linux:** Python 3.12 +- **macOS:** Python 3.12 (Requires macOS 10.9 or later, however macOS 11.0 or later may be required for library support) -**Python 3.12 may be supported now, however it is not tested at this time.** - -First, install the required dependencies: -``` -pip install -r requirements.txt -``` -Then, use the command for your platform to build an executable with Nuitka: - -**Windows** +First, make sure you're inside a venv, and then install the required dependencies: ```shell -python -m nuitka --show-progress --include-data-dir=data=data --include-data-dir=resources=resources --assume-yes-for-downloads --onefile --windows-icon-from-ico=resources/icon.png --plugin-enable=pyside6 NUSGet.py --windows-console-mode=disable +pip install --upgrade -r requirements.txt ``` +After that, follow the directions for your platform. -**Linux** +### Linux and macOS +A Makefile is available to build NUSGet on Linux and macOS. **On Linux**, this will give you an executable named `NUSGet` in the root of the project directory. **On macOS**, you'll instead get an application bundle named `NUSGet.app`. ```shell -python -m nuitka --show-progress --include-data-dir=data=data --include-data-dir=resources=resources --assume-yes-for-downloads --onefile --plugin-enable=pyside6 NUSGet.py -o NUSGet +make all ``` -**macOS** +Optionally, **on Linux**, you can install NUSGet so that it's available system-wide. This will install it into `/opt/NUSGet/`. ```shell -python -m nuitka --show-progress --include-data-dir=data=data --include-data-dir=resources=resources --assume-yes-for-downloads --onefile --plugin-enable=pyside6 NUSGet.py --macos-create-app-bundle --macos-app-icon=resources/icon.png +sudo make install ``` +On macOS, you can instead put the application bundle in `/Applications/` just like any other program. -The result will be a single binary named `NUSGet` that contains everything required to run NUSGet. No dependencies are needed on the target system. On Windows and macOS, this will also embed the icon in the program. - - -### For Linux Users: -A Makefile has been included to both build and install NUSGet on Linux. This will automatically set up NUSGet under `/opt/` and install a .desktop file to `/usr/share/applications/` so you can use it like any other application. - -First, use make to build NUSGet (this automates the step above): +### Windows +On Windows, you can use the PowerShell script `Build.ps1` in place of the Makefile. This will give you an executable named `NUSGet.exe` in the root of the project directory. ```shell -make linux +.\Build.ps1 ``` -Then, run the install command with `sudo` (or your favorite alternative): -```shell -sudo make linux-install -``` +## Translations +A huge thanks to all the wonderful translators who've helped make NUSGet available to more people! + - **German:** [@yeah-its-gloria](https://github.com/yeah-its-gloria) + - **Italian:** [@LNLenost](https://github.com/LNLenost) + - **Korean:** [@DDinghoya](https://github.com/DDinghoya) + - **Norwegian:** [@Rolfie](https://github.com/rolfiee) + - **Romanian:** [@NotImplementedLife](https://github.com/NotImplementedLife) + +If your language isn't present or is out of date, and you'd like to contribute, you can check out [TRANSLATING.md](https://github.com/NinjaCheetah/NUSGet/blob/main/TRANSLATING.md) for directions on how to translate NUSGet. ## Why this and not NUSD?