Updated build process, workflow, and build directions in README

This commit is contained in:
Campbell 2024-11-16 22:50:36 -05:00
parent 7c35e2090d
commit c716291c2d
Signed by: NinjaCheetah
GPG Key ID: B547958AF96ED344
5 changed files with 88 additions and 51 deletions

View File

@ -1,5 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python # This workflow will install Python dependencies and then build NUSGet for all platforms
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application name: Python application
@ -30,8 +29,7 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Build Package - name: Build Package
run: | run: make all
make linux
- name: Prepare Package for Upload - name: Prepare Package for Upload
run: | run: |
mv NUSGet ~/NUSGet mv NUSGet ~/NUSGet
@ -41,7 +39,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
path: ~/NUSGet.tar path: ~/NUSGet.tar
name: NUSGet-linux-bin name: NUSGet-Linux-bin
build-macos-x86: build-macos-x86:
@ -58,9 +56,7 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Build Package - name: Build Package
run: | run: ARCH_FLAGS=--macos-target-arch=x86_64 make all
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
- name: Prepare Package for Upload - name: Prepare Package for Upload
run: | run: |
mv NUSGet.app ~/NUSGet.app mv NUSGet.app ~/NUSGet.app
@ -70,7 +66,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
path: ~/NUSGet.tar path: ~/NUSGet.tar
name: NUSGet-macos-x86-bin name: NUSGet-macOS-x86_64-bin
build-macos-arm64: build-macos-arm64:
@ -87,9 +83,7 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Build Package - name: Build Package
run: | run: ARCH_FLAGS=--macos-target-arch=arm64 make all
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
- name: Prepare Package for Upload - name: Prepare Package for Upload
run: | run: |
mv NUSGet.app ~/NUSGet.app mv NUSGet.app ~/NUSGet.app
@ -99,7 +93,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
path: ~/NUSGet.tar path: ~/NUSGet.tar
name: NUSGet-macos-arm64-bin name: NUSGet-macOS-arm64-bin
build-windows: build-windows:
@ -118,17 +112,14 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Build Package - name: Build Package
run: | run: .\Build.ps1
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
- name: Upload Package - name: Upload Package
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
path: D:\a\NUSGet\NUSGet\NUSGet.dist path: D:\a\NUSGet\NUSGet\NUSGet.dist
name: NUSGet-windows-bin name: NUSGet-Windows-bin
- name: Upload Onefile Package - name: Upload Onefile Package
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
path: D:\a\NUSGet\NUSGet\NUSGet.exe path: D:\a\NUSGet\NUSGet\NUSGet.exe
name: NUSGet-windows-onefile-bin name: NUSGet-Windows-onefile-bin

33
Build.ps1 Normal file
View File

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

View File

@ -1,10 +1,11 @@
CC=python -m nuitka CC=python -m nuitka
ARCH_FLAGS?=
linux: all:
python build_translations.py 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 -d /opt/NUSGet
install NUSGet /opt/NUSGet/ install NUSGet /opt/NUSGet/
install ./packaging/icon.png /opt/NUSGet/NUSGet.png install ./packaging/icon.png /opt/NUSGet/NUSGet.png

View File

@ -1,6 +1,23 @@
# "NUSGet.py", licensed under the MIT license # "NUSGet.py", licensed under the MIT license
# Copyright 2024 NinjaCheetah # 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 os
import sys import sys
import json import json

View File

@ -33,48 +33,43 @@ For basic usage on all platforms, you can download the latest release for your o
## Building ## Building
### System Requirements ### System Requirements
- **Windows:** Python 3.11 (Requires Windows 8.1 or later) - **Windows:** Python 3.12 (Requires Windows 8.1 or later)
- **Linux:** Python 3.11 - **Linux:** Python 3.12
- **macOS:** Python 3.11 (Requires macOS 10.9 or later, however macOS 11.0 or later may be required for library support) - **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, make sure you're inside a venv, and then install the required dependencies:
First, install the required dependencies:
```
pip install -r requirements.txt
```
Then, use the command for your platform to build an executable with Nuitka:
**Windows**
```shell ```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 ```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 ```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. ### 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.
### 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):
```shell ```shell
make linux .\Build.ps1
``` ```
Then, run the install command with `sudo` (or your favorite alternative): ## Translations
```shell A huge thanks to all the wonderful translators who've helped make NUSGet available to more people!
sudo make linux-install - **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? ## Why this and not NUSD?