1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
From: Colin Watson <cjwatson@debian.org>
Date: Thu, 11 Dec 2025 11:23:06 +0000
Subject: Fix Cython build with Python 3.14
As described in https://bugs.debian.org/1122023, the Cython build fails
with Python 3.14. This is similar to #23; it has come back because
Python 3.14 changed the default start method to `forkserver`, which has
similar properties to `spawn` in this area.
Rather than continuing to play whack-a-mole by special-casing more start
methods, it's better to take the approach suggested in
https://github.com/akornatskyy/wheezy.template/issues/23#issuecomment-737210953
and move most of `setup.py` into a function.
Forwarded: https://github.com/akornatskyy/wheezy.template/pull/117
Bug-Debian: https://bugs.debian.org/1122023
Last-Update: 2025-12-11
---
setup.py | 141 ++++++++++++++++++++++++++++++++-------------------------------
1 file changed, 72 insertions(+), 69 deletions(-)
diff --git a/setup.py b/setup.py
index e339b9c..ebb0f1a 100644
--- a/setup.py
+++ b/setup.py
@@ -1,81 +1,84 @@
#!/usr/bin/env python
-import multiprocessing
import os
import re
from setuptools import setup # type: ignore[import]
-extra = {}
-try:
- from Cython.Build import cythonize # type: ignore[import]
- p = os.path.join("src", "wheezy", "template")
- extra["ext_modules"] = cythonize(
- [os.path.join(p, "*.py"), os.path.join(p, "ext", "*.py")],
- exclude=[
- os.path.join(p, "__init__.py"),
- os.path.join(p, "ext", "__init__.py"),
- ],
- # https://github.com/cython/cython/issues/3262
- nthreads=0 if multiprocessing.get_start_method() == "spawn" else 2,
- compiler_directives={"language_level": 3},
- quiet=True,
+def run_build():
+ extra = {}
+ try:
+ from Cython.Build import cythonize # type: ignore[import]
+
+ p = os.path.join("src", "wheezy", "template")
+ extra["ext_modules"] = cythonize(
+ [os.path.join(p, "*.py"), os.path.join(p, "ext", "*.py")],
+ exclude=[
+ os.path.join(p, "__init__.py"),
+ os.path.join(p, "ext", "__init__.py"),
+ ],
+ compiler_directives={"language_level": 3},
+ quiet=True,
+ )
+ except ImportError:
+ pass
+
+ README = open("README.md").read()
+ VERSION = (
+ re.search( # type: ignore
+ r'__version__ = "(.+)"',
+ open("src/wheezy/template/__init__.py").read(),
+ )
+ .group(1)
+ .strip()
)
-except ImportError:
- pass
-README = open("README.md").read()
-VERSION = (
- re.search( # type: ignore
- r'__version__ = "(.+)"',
- open("src/wheezy/template/__init__.py").read(),
+ setup(
+ name="wheezy.template",
+ version=VERSION,
+ python_requires=">=3.9",
+ description="A lightweight template library",
+ long_description=README,
+ long_description_content_type="text/markdown",
+ url="https://github.com/akornatskyy/wheezy.template",
+ author="Andriy Kornatskyy",
+ author_email="andriy.kornatskyy@live.com",
+ license="MIT",
+ classifiers=[
+ "Environment :: Web Environment",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: MIT License",
+ "Natural Language :: English",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
+ "Programming Language :: Python :: Implementation :: CPython",
+ "Programming Language :: Python :: Implementation :: PyPy",
+ "Topic :: Internet :: WWW/HTTP",
+ "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ "Topic :: Software Development :: Widget Sets",
+ "Topic :: Text Processing :: Markup :: HTML",
+ ],
+ keywords="html markup template preprocessor",
+ packages=["wheezy", "wheezy.template", "wheezy.template.ext"],
+ package_data={"wheezy.template": ["py.typed"]},
+ package_dir={"": "src"},
+ namespace_packages=["wheezy"],
+ zip_safe=False,
+ install_requires=[],
+ entry_points={
+ "console_scripts": ["wheezy.template=wheezy.template.console:main"]
+ },
+ platforms="any",
+ **extra
)
- .group(1)
- .strip()
-)
-setup(
- name="wheezy.template",
- version=VERSION,
- python_requires=">=3.9",
- description="A lightweight template library",
- long_description=README,
- long_description_content_type="text/markdown",
- url="https://github.com/akornatskyy/wheezy.template",
- author="Andriy Kornatskyy",
- author_email="andriy.kornatskyy@live.com",
- license="MIT",
- classifiers=[
- "Environment :: Web Environment",
- "Intended Audience :: Developers",
- "License :: OSI Approved :: MIT License",
- "Natural Language :: English",
- "Operating System :: OS Independent",
- "Programming Language :: Python",
- "Programming Language :: Python :: 3.9",
- "Programming Language :: Python :: 3.10",
- "Programming Language :: Python :: 3.11",
- "Programming Language :: Python :: 3.12",
- "Programming Language :: Python :: 3.13",
- "Programming Language :: Python :: Implementation :: CPython",
- "Programming Language :: Python :: Implementation :: PyPy",
- "Topic :: Internet :: WWW/HTTP",
- "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
- "Topic :: Software Development :: Libraries :: Python Modules",
- "Topic :: Software Development :: Widget Sets",
- "Topic :: Text Processing :: Markup :: HTML",
- ],
- keywords="html markup template preprocessor",
- packages=["wheezy", "wheezy.template", "wheezy.template.ext"],
- package_data={"wheezy.template": ["py.typed"]},
- package_dir={"": "src"},
- namespace_packages=["wheezy"],
- zip_safe=False,
- install_requires=[],
- entry_points={
- "console_scripts": ["wheezy.template=wheezy.template.console:main"]
- },
- platforms="any",
- **extra
-)
+
+if __name__ == "__main__":
+ run_build()
|