Skip to content

Commit

Permalink
Merge branch 'pygame-community:main' into sprite-collision
Browse files Browse the repository at this point in the history
  • Loading branch information
aatle authored Jan 15, 2025
2 parents 8d97ced + 146c43c commit e099866
Show file tree
Hide file tree
Showing 129 changed files with 2,660 additions and 1,502 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- run:
name: Build the Linux wheels.
command: |
pip3 install --user cibuildwheel==2.21.3
pip3 install --user cibuildwheel==2.22.0
PATH="$HOME/.local/bin:$PATH" cibuildwheel --output-dir wheelhouse
- store_artifacts:
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/build-debian-multiarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ env:
apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev -y
apt-get install libfreetype6-dev libportmidi-dev fontconfig -y
apt-get install python3-dev python3-pip python3-wheel python3-sphinx -y
pip3 install meson-python --break-system-packages
pip3 install meson-python "sphinx-autoapi<=3.3.2" --break-system-packages
jobs:
build-multiarch:
Expand Down Expand Up @@ -96,13 +96,11 @@ jobs:
install: ${{ env.INSTALL_CMD }}

# Build a wheel, install it for running unit tests.
# --no-build-isolation is passed so that preinstalled meson-python can be used
# (done for optimization reasons)
# pip does not know that ninja is installed, and tries to install it again.
# so pass --ignore-dep ninja explicitly
run: |
echo "\nBuilding pygame wheel\n"
pip3 wheel . --no-build-isolation --wheel-dir /artifacts -vvv
echo "\nInstalling wheel\n"
pip3 install --no-index --pre --break-system-packages --find-links /artifacts pygame-ce
echo "\nBuilding and installing pygame wheel\n"
PIP_BREAK_SYSTEM_PACKAGES=1 python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax
echo "\nRunning tests\n"
export SDL_VIDEODRIVER=dummy
export SDL_AUDIODRIVER=disk
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

- name: Test for Mac Deps cache hit
id: macdep-cache
uses: actions/cache@v4.1.2
uses: actions/cache@v4.2.0
with:
path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }}
# The hash of all files in buildconfig manylinux-build and macdependencies is
Expand All @@ -64,7 +64,7 @@ jobs:
if: steps.macdep-cache.outputs.cache-hit != 'true'
run: |
export MAC_ARCH="${{ matrix.macarch }}"
brew install coreutils pkg-config
brew install coreutils
cd buildconfig/macdependencies
bash ./build_mac_deps.sh
Expand Down Expand Up @@ -104,7 +104,6 @@ jobs:

# Setup macOS dependencies
CIBW_BEFORE_ALL: |
brew install pkg-config
cd buildconfig/macdependencies
cp -r ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }} ${{ github.workspace }}/pygame_mac_deps
bash ./install_mac_deps.sh
Expand All @@ -119,14 +118,14 @@ jobs:
- uses: actions/[email protected]

- name: pip cache
uses: actions/cache@v4.1.2
uses: actions/cache@v4.2.0
with:
path: ~/Library/Caches/pip # This cache path is only right on mac
key: pip-cache-${{ matrix.macarch }}-${{ matrix.os }}

- name: Fetch Mac deps
id: macdep-cache
uses: actions/cache@v4.1.2
uses: actions/cache@v4.2.0
with:
path: ${{ github.workspace }}/pygame_mac_deps_${{ matrix.macarch }}
key: macdep-${{ hashFiles('buildconfig/manylinux-build/**') }}-${{ hashFiles('buildconfig/macdependencies/*.sh') }}-${{ matrix.macarch }}
Expand All @@ -135,10 +134,10 @@ jobs:
- name: Install uv for speed
uses: yezz123/setup-uv@v4
with:
uv-version: "0.4.10"
uv-version: "0.5.4"

- name: Build and test wheels
uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v2.22.0

- uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
with:
images: ghcr.io/${{ github.repository }}_${{ matrix.arch }}
tags: type=raw,value=${{ hashFiles('buildconfig/manylinux-build/**') }}

- name: Build and push Docker image
if: steps.inspect.outcome == 'failure'
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc
with:
context: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base
file: ${{ github.workspace }}/buildconfig/manylinux-build/docker_base/Dockerfile-${{ matrix.arch }}
Expand All @@ -91,7 +91,7 @@ jobs:
CIBW_MANYLINUX_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}
CIBW_MANYLINUX_PYPY_I686_IMAGE: ghcr.io/${{ github.repository }}_i686:${{ steps.meta.outputs.version }}

uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v2.22.0

# We upload the generated files under github actions assets
- name: Upload dist
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/build-on-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ jobs:
# mingw-w64-${{ matrix.env }}-freetype
# mingw-w64-${{ matrix.env }}-portmidi

- name: Building pygame wheel
run: |
pip3 wheel . --wheel-dir /artifacts -vvv --no-build-isolation
- name: Installing wheel
run: pip3 install --no-index --pre --find-links /artifacts pygame-ce
# pip does not know that ninja is installed, and tries to install it again.
# so pass --ignore-dep ninja explicitly
- name: Build and install pygame wheel
run: python3 dev.py --ignore-dep ninja build --wheel /artifacts --lax

- name: Run tests
env:
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/build-sdl3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ jobs:

- name: Install pygame deps (linux)
if: matrix.os == 'ubuntu-24.04'
run: sudo apt-get install libfreetype6-dev libportmidi-dev python3-dev
run: |
sudo apt-get update --fix-missing
sudo apt-get install libfreetype6-dev libportmidi-dev python3-dev
- name: Install pygame deps (mac)
if: matrix.os == 'macos-14'
Expand Down Expand Up @@ -84,6 +86,17 @@ jobs:
cmake --build . --config Release --parallel
sudo cmake --install . --config Release
- name: Install SDL3_image
if: matrix.os != 'windows-latest'
run: |
git clone https://github.com/libsdl-org/SDL_image
cd SDL_image
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release --parallel
sudo cmake --install . --config Release
- name: Build with SDL3
run: python3 dev.py build --sdl3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu-sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:

- name: Test typestubs
run: |
pip3 install mypy
pip3 install mypy==1.13.0
python3 buildconfig/stubs/stubcheck.py
# We upload the generated files under github actions assets
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
- name: Install uv for speed
uses: yezz123/setup-uv@v4
with:
uv-version: "0.4.10"
uv-version: "0.5.4"

- name: Build and test wheels
uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v2.22.0

- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-gh-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: echo "VER=${GITHUB_REF_NAME#'release/'}" >> $GITHUB_OUTPUT

- name: Generate release attestation
uses: actions/attest-build-provenance@v1.4.4
uses: actions/attest-build-provenance@v2.1.0
with:
subject-path: "pygame-wheels/*"

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Dependency versions:


+----------+------------------------+
| CPython | >= 3.8 (Or use PyPy3) |
| CPython | >= 3.9 (Or use PyPy3) |
+----------+------------------------+
| SDL | >= 2.0.14 |
+----------+------------------------+
Expand Down
48 changes: 32 additions & 16 deletions buildconfig/download_win_prebuilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,24 @@ def get_urls(x86=True, x64=True):
url_sha1 = []
url_sha1.extend([
[
'https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-devel-2.30.9-VC.zip',
'd89a2ad46b98ba08db5ec5877cb2fde46e127825',
'https://github.com/libsdl-org/SDL/releases/download/release-2.30.11/SDL2-devel-2.30.11-VC.zip',
'163e3300a1450e6e7d4fff0d35b039c3eae44e79',
],
[
'https://github.com/libsdl-org/SDL/releases/download/preview-3.1.6/SDL3-devel-3.1.6-VC.zip',
'7a3b9ed85cfe735c7e106d98c4b6395a113e5d7e'
'https://github.com/libsdl-org/SDL/releases/download/preview-3.1.8/SDL3-devel-3.1.8-VC.zip',
'6b17cd6414d8f42b43a6006ddb2b40fd4c3b7c7b'
],
[
'https://github.com/pygame-community/SDL_image/releases/download/2.8.2-pgce/SDL2_image-devel-2.8.2-VCpgce.zip',
'983484dd816abf25cdd5bce88ac69dbca1ea713a'
'https://github.com/pygame-community/SDL_image/releases/download/2.8.4-pgce/SDL2_image-devel-2.8.4-VCpgce.zip',
'b9b4a5d44cab57901003255a1c1f98a42282762b'
],
[
'https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.22.0/SDL2_ttf-devel-2.22.0-VC.zip',
'2d4f131909af2985b5ebc5ed296d28628c87c243'
'https://github.com/libsdl-org/SDL_image/releases/download/preview-3.1.0/SDL3_image-devel-3.1.0-VC.zip',
'8538fea0cc4aabba2fc64db06196f1bb76a2785f'
],
[
'https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.24.0/SDL2_ttf-devel-2.24.0-VC.zip',
'2d18b9a4fc2ec0eee80de2a946b088d4e6efd0ee'
],
[
'https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.8.0/SDL2_mixer-devel-2.8.0-VC.zip',
Expand Down Expand Up @@ -205,14 +209,26 @@ def copy(src, dst):
copy(
os.path.join(
temp_dir,
'SDL2_image-devel-2.8.2-VCpgce/SDL2_image-2.8.2'
'SDL2_image-devel-2.8.4-VCpgce/SDL2_image-2.8.4'
),
os.path.join(
move_to_dir,
prebuilt_dir,
'SDL2_image-2.8.4'
)
)
copy(
os.path.join(
temp_dir,
'SDL3_image-devel-3.1.0-VC/SDL3_image-3.1.0'
),
os.path.join(
move_to_dir,
prebuilt_dir,
'SDL2_image-2.8.2'
'SDL3_image-3.1.0'
)
)

copy(
os.path.join(
temp_dir,
Expand All @@ -227,34 +243,34 @@ def copy(src, dst):
copy(
os.path.join(
temp_dir,
'SDL2_ttf-devel-2.22.0-VC/SDL2_ttf-2.22.0'
'SDL2_ttf-devel-2.24.0-VC/SDL2_ttf-2.24.0'
),
os.path.join(
move_to_dir,
prebuilt_dir,
'SDL2_ttf-2.22.0'
'SDL2_ttf-2.24.0'
)
)
copy(
os.path.join(
temp_dir,
'SDL2-devel-2.30.9-VC/SDL2-2.30.9'
'SDL2-devel-2.30.11-VC/SDL2-2.30.11'
),
os.path.join(
move_to_dir,
prebuilt_dir,
'SDL2-2.30.9'
'SDL2-2.30.11'
)
)
copy(
os.path.join(
temp_dir,
'SDL3-devel-3.1.6-VC/SDL3-3.1.6'
'SDL3-devel-3.1.8-VC/SDL3-3.1.8'
),
os.path.join(
move_to_dir,
prebuilt_dir,
'SDL3-3.1.6'
'SDL3-3.1.8'
)
)

Expand Down
2 changes: 1 addition & 1 deletion buildconfig/manylinux-build/docker_base/Dockerfile-aarch64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_aarch64:2024.10.07-1
FROM quay.io/pypa/manylinux2014_aarch64:2024.11.16-1
ENV MAKEFLAGS="-j 2"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down
2 changes: 1 addition & 1 deletion buildconfig/manylinux-build/docker_base/Dockerfile-i686
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_i686:2024.10.07-1
FROM quay.io/pypa/manylinux2014_i686:2024.11.16-1
ENV MAKEFLAGS="-j 2"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down
2 changes: 1 addition & 1 deletion buildconfig/manylinux-build/docker_base/Dockerfile-x86_64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pin version on image for CI stability
FROM quay.io/pypa/manylinux2014_x86_64:2024.10.07-1
FROM quay.io/pypa/manylinux2014_x86_64:2024.11.16-1
ENV MAKEFLAGS="-j 2"
ENV PG_DEP_PREFIX="/usr/local"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ set -e -x

cd $(dirname `readlink -f "$0"`)

SDL2_VER="2.30.9"
SDL2_VER="2.30.11"
SDL2="SDL2-$SDL2_VER"
IMG2_VER="2.8.2"
IMG2_VER="2.8.4"
IMG2="SDL2_image-$IMG2_VER"
TTF2_VER="2.22.0"
TTF2_VER="2.24.0"
TTF2="SDL2_ttf-$TTF2_VER"
MIX2_VER="2.8.0"
MIX2="SDL2_mixer-$MIX2_VER"
Expand Down
6 changes: 3 additions & 3 deletions buildconfig/manylinux-build/docker_base/sdl_libs/sdl2.sha512
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
30dfa86fcced174fef0ed78ffa53476a31765e19cdcdf8233ab92876445b4dedaa758fc42a3ec332324d13faa2daafcadcc44fc0f536a2969ef836162ec3cd36 SDL2-2.30.9.tar.gz
0ff345824f95158dfa72f83f9d4a540601c178cd759334bf849c14a2920b5330d0763413b58c08b3deba8d3a4ccb6ea2a8159f87efe4cbb0e8ea850f63d09454 SDL2_image-2.8.2.tar.gz
cd4c040ebe4ec74250e32b401a292658353721dda30ad1066522b2a9de9a07560313978880a0bad7e7f5103cc14278fcbe27dbc5a188189e7fb6f097e7308550 SDL2-2.30.11.tar.gz
a4b7436442be43b96dc7b90c9badd011da1622e283ae068b82367fcb72b7dd7a0357aec5550fe44103a77da75b8c570d5204fff11a805373f2194f92b8f71343 SDL2_image-2.8.4.tar.gz
5ddbc4b0b5fad2e0844a503daa79564b912654192599ef8fa7698531f08323ce01801f6bb17b2b3905020a3df362a967b7566ae725eb085da991578cc0807aad SDL2_mixer-2.8.0.tar.gz
34a1d210d8f1b1e802139d65ba47e36033bb7881e75a8862c1b1c515565bef85e3d81ee42e952aa664de043debef387ba60088a9cf3ba3297413db39a13af912 SDL2_ttf-2.22.0.tar.gz
a0f94e26f0387385f13ec1eb08ddca677d4181969073a50af387a0dce9c7bdddf393c028c8084538e01f875e19790ef7ae9a00c5106bf7ca9d21f3fcf9eee885 SDL2_ttf-2.24.0.tar.gz
2 changes: 2 additions & 0 deletions buildconfig/stubs/gen_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def get_all(mod: Any):
f.write(misc_stubs)

for mod, items in pygame_all_imports.items():
if mod == "pygame":
mod = "."
if len(items) <= 4:
# try to write imports in a single line if it can fit the line limit
import_items = (f"{string} as {string}" for string in items)
Expand Down
3 changes: 2 additions & 1 deletion buildconfig/stubs/pygame/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# A script to auto-generate locals.pyi, constants.pyi and __init__.pyi typestubs
# IMPORTANT NOTE: Do not edit this file by hand!

from pygame import (
from . import (
display as display,
draw as draw,
event as event,
Expand Down Expand Up @@ -111,6 +111,7 @@ from .constants import (
BLENDMODE_ADD as BLENDMODE_ADD,
BLENDMODE_BLEND as BLENDMODE_BLEND,
BLENDMODE_MOD as BLENDMODE_MOD,
BLENDMODE_MUL as BLENDMODE_MUL,
BLENDMODE_NONE as BLENDMODE_NONE,
BLEND_ADD as BLEND_ADD,
BLEND_ALPHA_SDL2 as BLEND_ALPHA_SDL2,
Expand Down
7 changes: 4 additions & 3 deletions buildconfig/stubs/pygame/_debug.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Tuple, Union, Optional, Callable
from collections.abc import Callable
from typing import Union, Optional

ImportResult = Tuple[str, bool, Optional[Callable]]
ImportResult = tuple[str, bool, Optional[Callable]]

def str_from_tuple(version_tuple: Union[Tuple[int, int, int], None]) -> str: ...
def str_from_tuple(version_tuple: Union[tuple[int, int, int], None]) -> str: ...
def attempt_import(module: str, function_name: str, output_str: str = "") -> ImportResult: ...
def print_debug_info(filename: Optional[str] = None) -> None: ...
Loading

0 comments on commit e099866

Please sign in to comment.