From 22d4fd8f70bcd7a62565222c5c578d84d746924e Mon Sep 17 00:00:00 2001 From: Matt Davis <6775756+nitzmahone@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:58:52 -0700 Subject: [PATCH] Move most packaging metadata to pyproject.toml (#129) * move most metadata to pyproject.toml * use environment marker for conditional pycparser dep * fix version test --- pyproject.toml | 43 +++++++++++++++++++++++++++++++ setup.cfg | 10 -------- setup.py | 48 ----------------------------------- testing/cffi0/test_version.py | 6 ++--- 4 files changed, 46 insertions(+), 61 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index 3db8907f..abd7b948 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,3 +5,46 @@ requires = [ "setuptools >= 66.1" ] build-backend = "setuptools.build_meta" + +[project] +name = "cffi" +version = "1.18.0.dev0" +dependencies = [ + "pycparser; implementation_name != 'PyPy'", +] +requires-python = ">=3.8" + +description = "Foreign Function Interface for Python calling C code." +readme = {file = "README.md", content-type = "text/markdown"} +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "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 :: 3.13", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "License :: OSI Approved :: MIT License", +] +authors = [ + {name = "Armin Rigo"}, + {name = "Maciej Fijalkowski"}, +] +maintainers = [ + {name = "Matt Davis"}, + {name = "Matt Clay"}, +] + +[project.entry-points."distutils.setup_keywords"] +cffi_modules = "cffi.setuptools_ext:cffi_modules" + +[project.urls] +Documentation = "https://cffi.readthedocs.io/" +Changelog = "https://cffi.readthedocs.io/en/latest/whatsnew.html" +Downloads = "https://github.com/python-cffi/cffi/releases" +Contact = "https://groups.google.com/forum/#!forum/python-cffi" +"Source Code" = "https://github.com/python-cffi/cffi" +"Issue Tracker" = "https://github.com/python-cffi/cffi/issues" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1b2e9de6..00000000 --- a/setup.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[metadata] -license_file = LICENSE -license_files = LICENSE -project_urls = - Documentation = http://cffi.readthedocs.org/ - Source Code = https://github.com/python-cffi/cffi - Issue Tracker = https://github.com/python-cffi/cffi/issues - Changelog = https://cffi.readthedocs.io/en/latest/whatsnew.html - Downloads = https://github.com/python-cffi/cffi/releases - Contact = https://groups.google.com/forum/#!forum/python-cffi diff --git a/setup.py b/setup.py index bf0d97e4..16f3cc8b 100644 --- a/setup.py +++ b/setup.py @@ -176,27 +176,7 @@ def has_ext_modules(self): # arguments mostly empty in this case. cpython = ('_cffi_backend' not in sys.builtin_module_names) - install_requires = [] - if cpython: - install_requires.append('pycparser') - setup( - name='cffi', - description='Foreign Function Interface for Python calling C code.', - long_description=""" -CFFI -==== - -Foreign Function Interface for Python calling C code. -Please see the `Documentation `_. - -Contact -------- - -`Mailing list `_ -""", - version='1.18.0.dev0', - python_requires='>=3.8', packages=['cffi'] if cpython else [], package_dir={"": "src"}, package_data={'cffi': ['_cffi_include.h', 'parse_c_type.h', @@ -204,12 +184,6 @@ def has_ext_modules(self): if cpython else {}, zip_safe=False, - url='http://cffi.readthedocs.org', - author='Armin Rigo, Maciej Fijalkowski', - author_email='python-cffi@googlegroups.com', - - license='MIT', - distclass=CFFIDistribution, ext_modules=[Extension( name='_cffi_backend', @@ -222,26 +196,4 @@ def has_ext_modules(self): extra_link_args=extra_link_args, extra_objects=forced_extra_objs, )] if cpython else [], - - install_requires=install_requires, - - entry_points = { - "distutils.setup_keywords": [ - "cffi_modules = cffi.setuptools_ext:cffi_modules", - ], - }, - - classifiers=[ - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - '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 :: 3.13', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'License :: OSI Approved :: MIT License', - ], ) diff --git a/testing/cffi0/test_version.py b/testing/cffi0/test_version.py index d04a7924..b5060c6e 100644 --- a/testing/cffi0/test_version.py +++ b/testing/cffi0/test_version.py @@ -38,13 +38,13 @@ def test_doc_version(): assert ("version = '%s'\n" % v[:4]) in content assert ("release = '%s'\n" % v) in content -def test_setup_version(): +def test_pyproject_version(): cffi_root = Path(os.path.dirname(__file__)).parent.parent - p = cffi_root / 'setup.py' + p = cffi_root / 'pyproject.toml' content = _read(p) # v = cffi.__version__.replace('+', '') - assert ("version='%s'" % v) in content + assert f'version = "{v}"' in content def test_c_version(): cffi_root = Path(os.path.dirname(__file__)).parent.parent