Introduce basic pyproject.toml, supporting existing build methods only (#2687)

* Add pyproject.toml with only name and dynamic fields

* Add build-system section to pyproject.toml with build requirements

Explicitly set the fallback build backend `setuptools.build_meta:__legacy__`

* Replace wheel.bdist_wheel import with setuptools equivalent

There is a deprecation warning that will be enforced in october 2025

* Package `requests[security]` is a no-op since 2.26.0, published 2021-07-13, use only `requests >= 2.26.0`

* Add setuptools package configuration to pyproject.toml

* Exclude packages found at top level with setuptools config

Exclude buildtools/backports package found at top level with setuptools config

* Add dynamic metadata in setup-wxsvg.py too to avoid failing the build

---------

Co-authored-by: Edouard Choinière <echoix@users.noreply.github.com>
This commit is contained in:
Edouard Choinière
2025-02-03 19:52:44 -05:00
committed by GitHub
parent 5abeba2f5d
commit 961d14b9cc
4 changed files with 57 additions and 7 deletions

29
pyproject.toml Normal file
View File

@@ -0,0 +1,29 @@
[project]
name = "wxPython"
dynamic = [
"authors",
"classifiers",
"dependencies",
"description",
"keywords",
"license",
"readme",
"scripts",
"urls",
"version",
]
[build-system]
requires = [
"setuptools>=70.1",
"cython == 3.0.10",
"requests >= 2.26.0",
"sip == 6.9.1",
]
# Using "setuptools.build_meta:__legacy__" instead of "setuptools.build_meta" for now.
# Allows to have access to the folder on the search path when building, like before.
build-backend = "setuptools.build_meta:__legacy__"
[tool.setuptools.packages.find]
exclude = ["src", "buildtools*", "etgtools", "sphinxtools", "src", "unittests"]
namespaces = false

View File

@@ -6,8 +6,7 @@ sip == 6.9.1
wheel
twine
requests
requests[security]
requests >= 2.26.0
cython==3.0.10
pytest
pytest-xdist

View File

@@ -31,6 +31,28 @@ URL = "http://wxPython.org/"
DOWNLOAD_URL = "https://pypi.org/project/wxPython"
LICENSE = "wxWindows Library License (https://opensource.org/licenses/wxwindows.php)"
PLATFORMS = "WIN32,WIN64,OSX,POSIX"
KEYWORDS = "GUI,wx,wxWindows,wxWidgets,cross-platform,user-interface,awesome"
CLASSIFIERS = """\
Development Status :: 6 - Mature
Environment :: MacOS X :: Cocoa
Environment :: Win32 (MS Windows)
Environment :: X11 Applications :: GTK
Intended Audience :: Developers
License :: OSI Approved
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows :: Windows 7
Operating System :: Microsoft :: Windows :: Windows 10
Operating System :: POSIX
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development :: User Interfaces
"""
HERE = os.path.abspath(os.path.dirname(__file__))
PACKAGE = 'wx.svg'
@@ -68,7 +90,10 @@ setup(name = 'wx.svg',
url = URL,
download_url = DOWNLOAD_URL,
license = LICENSE,
classifiers = [c for c in CLASSIFIERS.split("\n") if c],
keywords = KEYWORDS,
#packages = [PACKAGE],
ext_modules = modules,
options = { 'build' : BUILD_OPTIONS, },
scripts = [],
)

View File

@@ -18,15 +18,12 @@ from distutils.command.build import build as orig_build
from setuptools.command.install import install as orig_install
from setuptools.command.bdist_egg import bdist_egg as orig_bdist_egg
from setuptools.command.sdist import sdist as orig_sdist
try:
from wheel.bdist_wheel import bdist_wheel as orig_bdist_wheel
haveWheel = True
except ImportError:
haveWheel = False
from setuptools.command.bdist_wheel import bdist_wheel as orig_bdist_wheel
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
import buildtools.version as version
haveWheel = True
# Create a buildtools.config.Configuration object
cfg = Config(noWxConfig=True)