Files
lutris/Makefile
Daniel Johnson 8aefeba99e Replace custom GtkTemplate wrapper with native Gtk.Template
Removes lutris/gui/widgets/gi_composites.py, a GTK 3 compatibility
shim that pre-parsed <signal> elements out of templates and connected
them manually. GTK 4 + modern PyGObject supports Gtk.Template natively,
so LutrisWindow, DownloadQueue, and UninstallDialog now use the
standard decorator and @Gtk.Template.Callback().

UninstallDialog needs a workaround: PyGObject's auto-init hook fires
during GObject construction, which is too early for GtkDialog to pick
up <child type="titlebar">, silently losing the header bar. The dialog
temporarily stubs __dontuse_ginstance_init__ so init runs after
super().__init__().

LutrisWindow.on_destroy never fires when the last window closes (the
application quits before the signal is emitted), so thread cleanup
moves into on_window_delete's fall-through case where the close
decision is actually made.

Also updates the Makefile to install the GTK 4 pygobject-stubs config
for make dev, and documents the GTK 3/GTK 4 stub switch in
GTK4-MIGRATION.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-25 09:28:06 -04:00

145 lines
3.5 KiB
Makefile

VERSION=`grep "__version__" lutris/__init__.py | cut -d" " -f 3 | sed 's|"\(.*\)"|\1|'`
GITBRANCH ?= master
# Default GPG key ID to use for package signing.
PPA_GPG_KEY_ID ?= 82D96E430A1F1C0F0502747E37B90EDD4E3EFAE4
PYTHON:=$(shell which python3)
PIP:=$(PYTHON) -m pip
all:
export GITBRANCH=master
debuild
debclean
unsigned:
export GITBRANCH=master
debuild -i -us -uc -b
debclean
# Build process for GitHub runners.
# Requires two environment variables related to package signing.
# PPA_GPG_KEY_ID
# Key ID used to sign the .deb package files.
# PPA_GPG_PASSPHRASE
# Decrypts the private key associated with GPG_KEY_ID.
#
# When running from a GitHub workflow. The above environment variables
# are passed in from .github/scripts/build-ubuntu.sh and that script
# receives those variables from the .github/workflows/publish-lutris-ppa.yml
# which receives them from the repository secrets.
github-ppa:
export GITBRANCH=master
# Automating builds for different Ubuntu codenames manipulates the
# version string, and so that lintian check is suppressed. Also note
# that all parameters after "--lintian-opts" are passed to lintian
# so that _must_ be the last parameter.
echo "y" | debuild -S \
-k"${PPA_GPG_KEY_ID}" \
-p"gpg --batch --passphrase ${PPA_GPG_PASSPHRASE} --pinentry-mode loopback" \
--lintian-opts --suppress-tags malformed-debian-changelog-version
build-deps-ubuntu:
sudo apt install devscripts debhelper dh-python meson
build:
gbp buildpackage --git-debian-branch=${GITBRANCH}
clean:
debclean
build-source: clean
gbp buildpackage -S --git-debian-branch=${GITBRANCH}
mkdir build
mv ../lutris_${VERSION}* build
release: build-source upload upload-ppa
test:
rm tests/fixtures/pga.db -f
nose2
cover:
rm tests/fixtures/pga.db -f
rm tests/coverage/ -rf
nose2 --with-coverage --cover-package=lutris --cover-html --cover-html-dir=tests/coverage
pgp-renew:
osc signkey --extend home:strycore
osc rebuildpac home:strycore --all
changelog-add:
EDITOR=vim dch -i
changelog-edit:
EDITOR=vim dch -e
upload:
scp build/lutris_${VERSION}.tar.xz anaheim:~/volumes/releases/
upload-ppa:
dput ppa:lutris-team/lutris build/lutris_${VERSION}*_source.changes
upload-staging:
dput --force ppa:lutris-team/lutris-staging build/lutris_${VERSION}*_source.changes
snap:
snapcraft clean lutris -s pull
snapcraft
req-python:
pip3 install PyYAML lxml requests Pillow setproctitle python-magic distro dbus-python types-requests \
types-PyYAML evdev PyGObject pypresence protobuf moddb
install-hooks:
ln -sf -t .git/hooks/ ../../.hooks/pre-commit
dev: install-hooks
pip3 install ruff==0.12.1 mypy==1.16.1 mypy-baseline nose2
pip3 install 'pygobject-stubs>=2.17.0' --no-cache-dir --config-settings=config=Gtk4,Gdk4,Soup2
# ============
# Style checks
# ============
style:
ruff format . --check
format:
ruff check --select I --fix
ruff format .
# ===============
# Static analysis
# ===============
check: ruff_lint mypy syntax-compat annotation-compat po-check
ruff_lint:
ruff check .
syntax-compat:
python3 -m compileall -q lutris/
annotation-compat:
python3 utils/check_annotations.py
po-check:
@for f in po/*.po; do msgfmt --check "$$f" -o /dev/null; done
mypy:
mypy . --python-version 3.10 --install-types --non-interactive 2>&1 | mypy-baseline filter
mypy-reset-baseline: # Add new typing errors to mypy. Use sparingly.
mypy . --python-version 3.10 --install-types --non-interactive 2>&1 | mypy-baseline sync
# =============
# Abbreviations
# =============
sc: style check
styles: style
checks: check