Skip to content

Commit 551877a

Browse files
authored
Merge branch 'lordmauve:main' into actor_angle_movement
2 parents 3d87ac2 + 2a17da8 commit 551877a

File tree

7 files changed

+92
-22
lines changed

7 files changed

+92
-22
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ jobs:
44
build:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v2
7+
- name: Install xvfb and pulseaudio
8+
run: |
9+
sudo apt update
10+
sudo apt install -y xvfb pulseaudio
11+
- uses: actions/checkout@v4
812
- name: Set up Python 3.x
9-
uses: actions/setup-python@v2
13+
uses: actions/setup-python@v5
1014
with:
11-
python-version: 3.x
15+
python-version: '3.12'
1216
- name: Install dependencies
1317
run: |
1418
python -m pip install --upgrade pip
@@ -21,18 +25,14 @@ jobs:
2125
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2226
# stricter tests for mission critical code
2327
flake8 --count src test
24-
25-
- name: Install xvfb and pulseaudio
26-
run: |
27-
sudo apt-get install xvfb pulseaudio
2828
- name: Run tests under xvfb
2929
run: |
3030
export XDG_RUNTIME_DIR="$RUNNER_TEMP"
3131
pulseaudio -D --start
3232
xvfb-run --auto-servernum pytest
3333
- name: Cleanup xvfb pidx
3434
uses: bcomnes/cleanup-xvfb@v1
35-
- uses: actions/upload-artifact@master
35+
- uses: actions/upload-artifact@v4
3636
if: ${{ failure() }}
3737
with:
3838
name: failed-image

.github/workflows/wheels.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
name: "Build Wheels"
22

33
on:
4-
workflow_dispatch:
54
push:
6-
release:
7-
types:
8-
- published
5+
branches:
6+
- main
7+
tags:
8+
- 'v*.*.*'
99

1010
jobs:
1111
buildpackage:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v1
15-
- uses: actions/setup-python@v2
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v4
1616
with:
17-
python-version: 3.8
17+
python-version: 3.12
1818

1919
- name: Install wheel and SDist requirements
2020
run: python -m pip install "setuptools>=42.0" wheel twine
2121

2222
- name: Build SDist
2323
run: python setup.py sdist bdist_wheel
2424

25-
- uses: actions/upload-artifact@v2
25+
- uses: actions/upload-artifact@v4
2626
with:
2727
path: |
2828
dist/*.tar.gz
@@ -33,13 +33,15 @@ jobs:
3333
runs-on: ubuntu-latest
3434
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
3535

36+
permissions:
37+
id-token: write
38+
39+
environment: release
40+
3641
steps:
37-
- uses: actions/download-artifact@v2
42+
- uses: actions/download-artifact@v4
3843
with:
3944
name: artifact
4045
path: dist
4146

42-
- uses: pypa/gh-action-pypi-publish@master
43-
with:
44-
user: __token__
45-
password: ${{ secrets.pypi_password }}
47+
- uses: pypa/[email protected]

.readthedocs.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.12"
12+
# You can also specify other tool versions:
13+
# nodejs: "20"
14+
# rust: "1.70"
15+
# golang: "1.20"
16+
17+
# Build documentation in the "doc/" directory with Sphinx
18+
sphinx:
19+
configuration: doc/conf.py
20+
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
21+
# builder: "dirhtml"
22+
# Fail on all warnings to avoid broken references
23+
# fail_on_warning: true
24+
25+
# Optionally build your docs in additional formats such as PDF and ePub
26+
formats:
27+
- pdf
28+
# - epub
29+
30+
# Optional but recommended, declare the Python requirements required
31+
# to build your documentation
32+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
33+
# python:
34+
# install:
35+
# - requirements: docs/requirements.txt

src/pgzero/loaders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def __dir__(self):
172172

173173

174174
class ImageLoader(ResourceLoader):
175-
EXTNS = ['png', 'gif', 'jpg', 'jpeg', 'bmp']
175+
EXTNS = ['png', 'gif', 'jpg', 'jpeg', 'bmp', 'webp']
176176
TYPE = 'image'
177177

178178
def _load(self, path):

src/pgzero/runner.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from . import storage
22
from . import clock
33
from . import loaders
4+
from . import __version__
45
from .game import PGZeroGame, DISPLAY_FLAGS
56
from types import ModuleType
67
from argparse import ArgumentParser
@@ -68,6 +69,11 @@ def main():
6869
action='store_true',
6970
help="Print periodic FPS measurements on the terminal."
7071
)
72+
parser.add_argument(
73+
'--version',
74+
action='version',
75+
version=f'%(prog)s {__version__}'
76+
)
7177
parser.add_argument(
7278
'game',
7379
help="The Pygame Zero game to run (a Python file or directory)."

test/images/alien_as_webp.webp

1.59 KB
Loading

test/test_webp_loader.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import unittest
2+
3+
import pygame
4+
5+
from pgzero.actor import Actor
6+
from pgzero.loaders import set_root
7+
8+
9+
TEST_DISP_W, TEST_DISP_H = (200, 100)
10+
11+
12+
class WebpLoaderTest(unittest.TestCase):
13+
@classmethod
14+
def setUpClass(self):
15+
pygame.init()
16+
pygame.display.set_mode((TEST_DISP_W, TEST_DISP_H))
17+
set_root(__file__)
18+
19+
@classmethod
20+
def tearDownClass(self):
21+
pygame.display.quit()
22+
23+
def test_loader_finds_webp(self):
24+
actor = Actor("alien_as_webp")
25+
26+
# Just instantiating the actor shows webp image loading works
27+
assert actor

0 commit comments

Comments
 (0)