From 961d14b9cca7daec18b2766cdbc529f13e91489f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Mon, 3 Feb 2025 19:52:44 -0500 Subject: [PATCH] Introduce basic pyproject.toml, supporting existing build methods only (#2687) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- pyproject.toml | 29 +++++++++++++++++++++++++++++ requirements/devel.txt | 3 +-- setup-wxsvg.py | 25 +++++++++++++++++++++++++ setup.py | 7 ++----- 4 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..0843ad0b --- /dev/null +++ b/pyproject.toml @@ -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 diff --git a/requirements/devel.txt b/requirements/devel.txt index f9c2964b..90bd3692 100644 --- a/requirements/devel.txt +++ b/requirements/devel.txt @@ -6,8 +6,7 @@ sip == 6.9.1 wheel twine -requests -requests[security] +requests >= 2.26.0 cython==3.0.10 pytest pytest-xdist diff --git a/setup-wxsvg.py b/setup-wxsvg.py index 0c20d565..e90bcc6d 100644 --- a/setup-wxsvg.py +++ b/setup-wxsvg.py @@ -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 = [], ) diff --git a/setup.py b/setup.py index 62704bfd..6f22edc1 100644 --- a/setup.py +++ b/setup.py @@ -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)