Skip to content

Commit c345ee7

Browse files
Merge branch 'main' into convert_palette_colorkey
love to fix merge conflicts
2 parents a84a2fd + 8a0744d commit c345ee7

File tree

160 files changed

+1438
-125470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1438
-125470
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- run:
4949
name: Build the Linux wheels.
5050
command: |
51-
pip3 install --user cibuildwheel==2.16.4
51+
pip3 install --user cibuildwheel==2.17.0
5252
PATH="$HOME/.local/bin:$PATH" cibuildwheel --output-dir wheelhouse
5353
5454
- store_artifacts:

.github/workflows/build-debian-multiarch.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ env:
4040
INSTALL_CMD: |
4141
apt-get update --fix-missing
4242
apt-get upgrade -y
43-
apt-get install build-essential meson -y
43+
apt-get install build-essential meson cython3 -y
4444
apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev -y
4545
apt-get install libfreetype6-dev libportmidi-dev fontconfig -y
4646
apt-get install python3-dev python3-pip python3-wheel python3-sphinx -y
@@ -65,7 +65,7 @@ jobs:
6565
- { arch: armv7, base_image: 'balenalib/raspberrypi3-debian:bookworm' }
6666

6767
steps:
68-
- uses: actions/[email protected].2
68+
- uses: actions/[email protected].6
6969

7070
- name: Build sources and run tests
7171
uses: uraimo/[email protected]

.github/workflows/build-emsdk.yml

+3-24
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,12 @@ jobs:
4040
SDK_ARCHIVE: python3.11-wasm-sdk-Ubuntu-22.04.tar.lz4
4141
SDKROOT: /opt/python-wasm-sdk
4242

43-
# use the most recent cython from github, but pin on a commit for CI
44-
# stability. This is also needed to benefit from caching cython installs
45-
LATEST_CYTHON_COMMIT: 2f3a781dcca092ce95fbfef2736b12b0d1ab50dd # cython 3.0.0
46-
47-
WHEELHOUSE_CYTHON: /tmp/wheelhouse/cython
48-
4943
steps:
50-
- uses: actions/[email protected]
51-
52-
- name: Cache Cython
53-
id: cache-cython
54-
uses: actions/[email protected]
55-
with:
56-
path: ${{ env.WHEELHOUSE_CYTHON }}
57-
key: wasm-ubuntu-cython-${{ env.LATEST_CYTHON_COMMIT }}-path-${{ env.WHEELHOUSE_CYTHON }}
58-
59-
# This builds the cython wheel and stores it in cache too
60-
- name: Download and build cython on cache miss
61-
if: steps.cache-cython.outputs.cache-hit != 'true'
62-
run: |
63-
mkdir -p $WHEELHOUSE_CYTHON
64-
pip wheel --wheel-dir $WHEELHOUSE_CYTHON git+https://github.com/cython/cython.git@$LATEST_CYTHON_COMMIT
44+
- uses: actions/[email protected]
6545

66-
- name: Install latest cython and regen
46+
- name: Regen with latest cython (using system python3)
6747
run: |
68-
pip install --no-index --find-links $WHEELHOUSE_CYTHON --pre cython
69-
touch $(find | grep pxd$)
48+
pip3 install cython==3.0.10
7049
python3 setup.py cython_only
7150
7251
- name: Install python-wasm-sdk

.github/workflows/build-macos.yml

+14-9
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@ concurrency:
3838
jobs:
3939
deps:
4040
name: ${{ matrix.macarch }} deps
41-
runs-on: macos-12
41+
runs-on: ${{ matrix.os }}
4242
strategy:
4343
matrix:
4444
# make arm64 deps and x86_64 deps
45-
macarch: [arm64, x86_64]
45+
include:
46+
- { macarch: arm64, os: macos-14 }
47+
- { macarch: x86_64, os: macos-13 }
4648

4749
steps:
48-
- uses: actions/[email protected].2
50+
- uses: actions/[email protected].6
4951

5052
- name: Test for Mac Deps cache hit
5153
id: macdep-cache
@@ -54,7 +56,7 @@ jobs:
5456
path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }}
5557
# The hash of all files in buildconfig manylinux-build and macdependencies is
5658
# the key to the cache. If anything changes here, the deps are built again
57-
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }}
59+
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }}-${{ matrix.os }}
5860
lookup-only: true
5961

6062
# build mac deps on cache miss
@@ -76,7 +78,7 @@ jobs:
7678
build:
7779
name: ${{ matrix.name }}
7880
needs: deps
79-
runs-on: macos-12
81+
runs-on: ${{ matrix.os }}
8082
strategy:
8183
fail-fast: false # if a particular matrix build fails, don't skip the rest
8284
matrix:
@@ -87,31 +89,36 @@ jobs:
8789
- {
8890
name: "x86_64 (CPython 3.9 - 3.12)",
8991
macarch: x86_64,
92+
os: macos-13,
9093
pyversions: "cp3{9,10,11,12}-*",
9194
}
9295

9396
- {
9497
name: "x86_64 (Python 3.8)",
9598
macarch: x86_64,
99+
os: macos-13,
96100
# CPython/PyPy 3.8
97101
pyversions: "?p38-*",
98102
}
99103

100104
- {
101105
name: "x86_64 (PyPy 3.9 and 3.10)",
102106
macarch: x86_64,
107+
os: macos-13,
103108
pyversions: "pp39-* pp310-*",
104109
}
105110

106111
- {
107112
name: "arm64 (CPython 3.8 - 3.10)",
108113
macarch: arm64,
114+
os: macos-14,
109115
pyversions: "cp3{8,9,10}-*",
110116
}
111117

112118
- {
113119
name: "arm64 (CPython 3.11 - 3.12)",
114120
macarch: arm64,
121+
os: macos-14,
115122
pyversions: "cp3{11,12}-*",
116123
}
117124

@@ -135,8 +142,6 @@ jobs:
135142

136143
CIBW_BUILD: ${{ matrix.pyversions }}
137144

138-
# Build arm64 and x86_64 wheels too on an Intel runner.
139-
# Note that the arm64 wheels cannot be tested on CI in this configuration
140145
CIBW_ARCHS: ${{ matrix.macarch }}
141146

142147
# Setup macOS dependencies
@@ -160,7 +165,7 @@ jobs:
160165
CIBW_BUILD_VERBOSITY: 2
161166

162167
steps:
163-
- uses: actions/[email protected].2
168+
- uses: actions/[email protected].6
164169

165170
- name: pip cache
166171
uses: actions/[email protected]
@@ -177,7 +182,7 @@ jobs:
177182
fail-on-cache-miss: true
178183

179184
- name: Build and test wheels
180-
uses: pypa/cibuildwheel@v2.16.4
185+
uses: pypa/cibuildwheel@v2.17.0
181186

182187
- uses: actions/upload-artifact@v4
183188
with:

.github/workflows/build-manylinux.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
CIBW_BUILD_VERBOSITY: 2
8080

8181
steps:
82-
- uses: actions/[email protected].2
82+
- uses: actions/[email protected].6
8383

8484
- name: Log in to the Container registry
8585
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
@@ -118,7 +118,7 @@ jobs:
118118
CIBW_MANYLINUX_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
119119
CIBW_MANYLINUX_PYPY_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
120120

121-
uses: pypa/cibuildwheel@v2.16.4
121+
uses: pypa/cibuildwheel@v2.17.0
122122

123123
# We upload the generated files under github actions assets
124124
- name: Upload dist

.github/workflows/build-on-msys2.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
# - { sys: clangarm64, env: clang-aarch64 }
5050

5151
steps:
52-
- uses: actions/[email protected].2
52+
- uses: actions/[email protected].6
5353
- uses: msys2/setup-msys2@v2
5454
with:
5555
msystem: ${{ matrix.sys }}
@@ -61,6 +61,7 @@ jobs:
6161
mingw-w64-${{ matrix.env }}-python-pip
6262
mingw-w64-${{ matrix.env }}-python-sphinx
6363
mingw-w64-${{ matrix.env }}-meson-python
64+
mingw-w64-${{ matrix.env }}-cython
6465
6566
# mingw-w64-${{ matrix.env }}-SDL2
6667
# mingw-w64-${{ matrix.env }}-SDL2_image

.github/workflows/build-ubuntu-sdist.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
os: [ubuntu-20.04, ubuntu-22.04]
5252

5353
steps:
54-
- uses: actions/[email protected].2
54+
- uses: actions/[email protected].6
5555

5656
- name: Install deps
5757
# install numpy from pip and not apt because the one from pip is newer,
@@ -80,7 +80,7 @@ jobs:
8080
if: matrix.os == 'ubuntu-22.04' # run stubtest only once
8181
run: |
8282
pip3 install mypy
83-
python3 setup.py stubcheck
83+
python3 buildconfig/stubs/stubcheck.py
8484
8585
# We upload the generated files under github actions assets
8686
- name: Upload sdist

.github/workflows/build-windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ jobs:
140140
CIBW_BUILD_VERBOSITY: 2
141141

142142
steps:
143-
- uses: actions/[email protected].2
143+
- uses: actions/[email protected].6
144144

145145
- uses: TheMrMilchmann/setup-msvc-dev@v3 # this lets us use the developer command prompt on windows
146146
with:
147147
arch: ${{ matrix.msvc-dev-arch }}
148148

149149
- name: Build and test wheels
150-
uses: pypa/cibuildwheel@v2.16.5
150+
uses: pypa/cibuildwheel@v2.17.0
151151

152152
- uses: actions/upload-artifact@v4
153153
with:

.github/workflows/cppcheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-20.04
2323

2424
steps:
25-
- uses: actions/[email protected].2
25+
- uses: actions/[email protected].6
2626

2727
- name: Install deps
2828
# https://github.com/actions/runner-images/issues/7192

.github/workflows/format-lint.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: python3 setup.py lint
22

33
# Run lint CI on changes to main branch, or any PR to main. Do not run CI on
44
# any other branch.
5-
# run only if there are changes on files that are linted (C, python and rst files)
5+
# Run only if there are changes on files that are linted (C, Python and rst files)
66
on:
77
push:
88
branches: main
@@ -30,7 +30,7 @@ jobs:
3030
pre-commit:
3131
runs-on: ubuntu-latest
3232
steps:
33-
- uses: actions/[email protected].2
33+
- uses: actions/[email protected].6
3434
- uses: actions/setup-python@v5
3535
with:
3636
python-version: 3.x
@@ -40,13 +40,13 @@ jobs:
4040
runs-on: ubuntu-22.04
4141

4242
steps:
43-
- uses: actions/[email protected].2
43+
- uses: actions/[email protected].6
4444

4545
- name: Install deps
46-
run: python3 -m pip install pylint black clang-format sphinx"<7.2.0"
46+
run: python3 -m pip install pylint sphinx"<7.2.0"
4747

48-
- name: Check code Formatting and Linting
49-
run: python3 setup.py lint
48+
- name: Check code linting
49+
run: pylint src_py docs
5050

5151
- name: Check docs changes are checked in
5252
run: |

.github/workflows/release-gh-draft.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
needs: [manylinux-aarch64, manylinux, macos, windows, sdist]
3434
runs-on: ubuntu-latest
3535
steps:
36-
- uses: actions/[email protected].2
36+
- uses: actions/[email protected].6
3737

3838
- name: Download all artifacts
3939
uses: actions/download-artifact@v4

.github/workflows/release-pypi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
# IMPORTANT: this permission is mandatory for trusted publishing
1313
id-token: write
1414
steps:
15-
- uses: actions/[email protected].2
15+
- uses: actions/[email protected].6
1616

1717
- name: Pull all release assets
1818
uses: robinraju/[email protected]

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ dist
4444
*.so
4545
__pycache__
4646
_headers/*
47+
48+
# cython generated files
49+
src_c/_sdl2/*.c
50+
!/src_c/_sdl2/touch.c
51+
src_c/pypm.c

.pre-commit-config.yaml

+6-12
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@
55
# Then in the project root directory run `pre-commit install`
66

77
repos:
8-
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.3.0
10-
hooks:
11-
- id: black
12-
exclude: |
13-
(?x)^(
14-
^buildconfig/.*$
15-
| ^docs/reST/.*$
16-
| setup.py
17-
)$
18-
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
rev: v0.4.2
10+
hooks: # See pyproject.toml for configuration options.
11+
- id: ruff-format # Run the formatter
12+
types_or: [ python, pyi, jupyter ]
1913

2014
- repo: https://github.com/pre-commit/mirrors-clang-format
21-
rev: v18.1.2
15+
rev: v18.1.4
2216
hooks:
2317
- id: clang-format
2418
exclude: |

buildconfig/config.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,12 @@ def prepdep(dep, basepath):
8080
if isinstance(dep.inc_dir, str):
8181
incs.append(IPREFIX+dep.inc_dir[startind:])
8282
else:
83-
for dir in dep.inc_dir:
84-
incs.append(IPREFIX+dir[startind:])
83+
incs.extend(IPREFIX+dir[startind:] for dir in dep.inc_dir)
8584
if dep.lib_dir:
8685
if isinstance(dep.lib_dir, str):
8786
lids.append(LPREFIX+dep.lib_dir[startind:])
8887
else:
89-
for dir in dep.lib_dir:
90-
lids.append(LPREFIX+dir[startind:])
88+
lids.extend(LPREFIX+dir[startind:] for dir in dep.lib_dir)
9189
libs = ''
9290
for lib in dep.libs:
9391
libs += ' -l' + lib

buildconfig/download_win_prebuilt.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def get_urls(x86=True, x64=True):
7878
url_sha1 = []
7979
url_sha1.extend([
8080
[
81-
'https://github.com/libsdl-org/SDL/releases/download/release-2.30.2/SDL2-devel-2.30.2-VC.zip',
82-
'f354c841e99a9894ff0f5ba85ec306184316e7b6',
81+
'https://github.com/libsdl-org/SDL/releases/download/release-2.30.3/SDL2-devel-2.30.3-VC.zip',
82+
'2878b4b1fbe9e4b22a317ad52c9d751c70e8df62',
8383
],
8484
[
8585
'https://github.com/pygame-community/SDL_image/releases/download/2.8.2-pgce/SDL2_image-devel-2.8.2-VCpgce.zip',
@@ -234,12 +234,12 @@ def copy(src, dst):
234234
copy(
235235
os.path.join(
236236
temp_dir,
237-
'SDL2-devel-2.30.2-VC/SDL2-2.30.2'
237+
'SDL2-devel-2.30.3-VC/SDL2-2.30.3'
238238
),
239239
os.path.join(
240240
move_to_dir,
241241
prebuilt_dir,
242-
'SDL2-2.30.2'
242+
'SDL2-2.30.3'
243243
)
244244
)
245245

0 commit comments

Comments
 (0)