-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,894 additions
and
1,782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build for Windows | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
shell: msys2 {0} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup MSYS2 | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
msystem: MINGW64 | ||
update: false # false | ||
install: >- | ||
mingw-w64-x86_64-python | ||
mingw-w64-x86_64-python-pip | ||
mingw-w64-x86_64-libgphoto2 | ||
mingw-w64-x86_64-qt6-base | ||
mingw-w64-x86_64-pkg-config | ||
mingw-w64-x86_64-python-pip | ||
mingw-w64-x86_64-python-pyqt6 | ||
mingw-w64-x86_64-python-pillow | ||
mingw-w64-x86_64-pyinstaller | ||
wget | ||
p7zip | ||
mingw-w64-x86_64-jq | ||
- name: Set up Python environment | ||
run: | | ||
python -m venv --system-site-packages .venv | ||
source .venv/bin/activate | ||
python -m pip install --upgrade pip | ||
python -m pip install -r requirements.txt | ||
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV | ||
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH | ||
- name: Build | ||
run: | | ||
chmod +x build_win.sh | ||
./build_win.sh | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
path: | | ||
dist/main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
# Get latest release info from GitHub API | ||
LIBUSB_RELEASE_INFO=$(wget -qO- https://api.github.com/repos/libusb/libusb/releases/latest) | ||
|
||
# Extract Windows release asset URL (only .7z file) | ||
LIBUSB_WIN_URL=$(echo "$LIBUSB_RELEASE_INFO" | \ | ||
jq -r '.assets[] | select(.name | endswith(".7z")) | .browser_download_url') | ||
LIBUSB_FILENAME=$(basename "$LIBUSB_WIN_URL") | ||
|
||
# Create vendor directory if it doesn't exist | ||
mkdir -p vendor/libusb | ||
|
||
# Download and extract | ||
cd vendor | ||
if [ ! -f "$LIBUSB_FILENAME" ]; then | ||
wget -N "$LIBUSB_WIN_URL" | ||
else | ||
echo $LIBUSB_FILENAME already exists, skipping download. | ||
fi | ||
7z x "$LIBUSB_FILENAME" -aos -olibusb | ||
|
||
# Clean up downloaded archive | ||
#rm libusb.7z | ||
|
||
cd .. | ||
|
||
pyinstaller --onedir \ | ||
--add-binary /mingw64/lib/libgphoto2_port/0.12.2/:. \ | ||
--add-binary /mingw64/lib/libgphoto2/2.5.31/:. \ | ||
--add-binary ./vendor/libusb/MinGW64/dll/libusb-1.0.dll:. \ | ||
--add-data ui:ui main.py \ | ||
--runtime-hook ./build_win_hook.py \ | ||
--noconfirm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import os | ||
import sys | ||
import logging | ||
|
||
logging.info(f"Set IOLIBS and CAMLIBS to: #{sys._MEIPASS}") | ||
os.environ["IOLIBS"] = sys._MEIPASS | ||
os.environ["CAMLIBS"] = sys._MEIPASS |
Oops, something went wrong.