Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Change log
- Fix ``bin/update-python-support`` not adding support for the newest Python
version after it stopped being the future one.

- Publish PyPy wheels for macOS, Windows and manylinux in the ``c-code``
template.


2.2 (2026-10-19)
----------------
Expand Down
6 changes: 4 additions & 2 deletions docs/narr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ The following options are only needed one time as their values are stored in
Enable running the tests on Windows on GitHub Actions.

--with-pypy
Enable PyPy support.
Enable PyPy support. For ``c-code`` packages this also publishes PyPy
wheels for macOS, Windows and manylinux.

--with-future-python
The package supports the next upcoming Python version which does not yet have
Expand Down Expand Up @@ -427,7 +428,8 @@ with-windows
Run the tests also on Windows on GitHub Actions: true/false, default: false

with-pypy
Does the package support PyPy: true/false
Does the package support PyPy: true/false. For ``c-code`` packages this
also publishes PyPy wheels for macOS, Windows and manylinux.

with-docs
Build the documentation via Sphinx: true/false
Expand Down
6 changes: 6 additions & 0 deletions src/zope/meta/c-code/manylinux-install.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ tox_env_map() {
*"cp%(future_python_shortversion)st"*) echo 'py%(future_python_shortversion)st';;
{% endif %}
*"cp%(future_python_shortversion)s"*) echo 'py%(future_python_shortversion)s';;
{% endif %}
{% if with_pypy %}
*"pp%(pypy_shortversion)s"*) echo 'pypy3';;
{% endif %}
*) echo 'py';;
esac
Expand All @@ -45,6 +48,9 @@ tox_env_map() {
# Compile wheels
for PYBIN in /opt/python/*/bin; do
if \
{% if with_pypy %}
[[ "${PYBIN}" == *"pp%(pypy_shortversion)s-"* ]] || \
{% endif %}
{% for py_version in supported_python_versions %}
[[ "${PYBIN}" == *"cp%(py_version)s/"* ]] {% if py_version != stop_at %}|| \
{% else %} ; then
Expand Down
2 changes: 0 additions & 2 deletions src/zope/meta/c-code/tests-strategy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
exclude:
{% endif %}
{% if with_pypy %}
- os: macos-latest
python-version: "pypy-%(pypy_version)s"
- os: windows-11-arm
python-version: "pypy-%(pypy_version)s"
{% endif %}
Expand Down
8 changes: 3 additions & 5 deletions src/zope/meta/c-code/tests.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ jobs:
{% for kind in ('macOS x86_64', 'macOS arm64') %}
- name: Upload %(package_name)s wheel (%(kind)s)
if: >
{% if kind == 'macOS x86_64' %}
startsWith(runner.os, 'Mac')
{% elif kind == 'macOS arm64' or kind == 'macOS universal2' %}
{% if kind == 'macOS x86_64' or kind == 'macOS universal2' %}
startsWith(runner.os, 'Mac')
&& !startsWith(matrix.python-version, 'pypy')
{% elif kind == 'macOS arm64' %}
startsWith(runner.os, 'Mac')
{% endif %}
uses: actions/upload-artifact@v7
with:
Expand Down Expand Up @@ -468,8 +468,6 @@ jobs:

- name: Remove undesired wheels (if any were downloaded)
run: |
# PyPy wheels shouldn't be uploaded, remove them if present
find dist/ -name "*pypy*" -type f -delete || true
find dist/ -name "*none-any*" -type f -delete || true
{% if with_future_python %}
# Wheels for the not-yet-supported future Python version need to go
Expand Down
2 changes: 2 additions & 0 deletions src/zope/meta/config_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ def manylinux_sh(self):
self.oldest_python, short_version=True,
freethreaded=self.with_free_threaded_python),
stop_at=stop_at,
with_pypy=self.with_pypy,
pypy_shortversion=PYPY_VERSION.replace('.', ''),
)
(self.path / '.manylinux-install.sh').chmod(0o755)
self.add_manylinux = True
Expand Down
63 changes: 63 additions & 0 deletions src/zope/meta/tests/test_config_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,66 @@ def test_config_package__tests_yml__c_code__2(self):
' needs: [build-package, manylinux, test, release-check]\n',
tests_yml)
self.assertNotIn(' docs:\n', tests_yml)

def test_config_package__tests_yml__c_code__3(self):
"""It builds, tests and publishes PyPy wheels on all platforms."""

tests_yml = render('tests.yml.j2', **dict(
self.context, with_pypy=True, with_windows=True))

self.assertNotIn(
' - os: macos-latest\n'
' python-version: "pypy-3.11"\n', tests_yml)
self.assertIn(
' - os: windows-11-arm\n'
' python-version: "pypy-3.11"\n', tests_yml)
self.assertNotIn('*pypy*', tests_yml)
self.assertIn(
' - name: Upload testpackage wheel (macOS arm64)\n'
' if: >\n'
" startsWith(runner.os, 'Mac')\n"
' uses:', tests_yml)


#: The values `PackageConfiguration.manylinux_sh()` passes to
#: `manylinux-install.sh.j2`.
MANYLINUX_INSTALL_CONTEXT = {
'config_type': 'c-code',
'future_python_shortversion': '315',
'manylinux_aarch64_tests': [],
'manylinux_install_setup': [],
'newest_python_shortversion': '314',
'package_name': 'testpackage',
'package_name_pattern': 'testpackage',
'pypy_shortversion': '311',
'stop_at': None,
'supported_python_versions': ['310', '311'],
'with_free_threaded_python': False,
'with_future_python': True,
'with_pypy': False,
}


class ManylinuxInstallTests(unittest.TestCase):
"""Tests for the `c-code` ``.manylinux-install.sh``."""

def test_config_package__manylinux_install_sh__1(self):
"""It builds and tests PyPy wheels if PyPy is supported."""

script = render(
'manylinux-install.sh.j2',
**dict(MANYLINUX_INSTALL_CONTEXT, with_pypy=True))

self.assertIn(
' if \\\n'
' [[ "${PYBIN}" == *"pp311-"* ]] || \\\n'
' [[ "${PYBIN}" == *"cp310/"* ]] || \\\n', script)
self.assertIn(""" *"pp311"*) echo 'pypy3';;\n""", script)

def test_config_package__manylinux_install_sh__2(self):
"""It does not build PyPy wheels if PyPy is not supported."""

script = render('manylinux-install.sh.j2', **MANYLINUX_INSTALL_CONTEXT)

self.assertNotIn('pp311', script)
self.assertNotIn('pypy3', script)
Loading