]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
py: use setup.cfg to configure setuptools
authorJeremy Sowden <jeremy@azazel.net>
Mon, 31 Jul 2023 11:40:23 +0000 (12:40 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 3 Aug 2023 07:47:49 +0000 (09:47 +0200)
Setuptools has had support for declarative configuration for several
years.  To quote their documentation:

  Setuptools allows using configuration files (usually setup.cfg) to
  define a package’s metadata and other options that are normally
  supplied to the setup() function (declarative config).

  This approach not only allows automation scenarios but also reduces
  boilerplate code in some cases.

Additionally, this allows us to introduce support for PEP-517-compatible
build-systems.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
py/Makefile.am
py/setup.cfg [new file with mode: 0644]
py/setup.py

index 4056aa61f82030bea417c50b9e5ebc94acc8aa8c..974539fd44ad2d2fe84f751d32244be9b486ba81 100644 (file)
@@ -1 +1 @@
-EXTRA_DIST = setup.py src
+EXTRA_DIST = setup.cfg setup.py src
diff --git a/py/setup.cfg b/py/setup.cfg
new file mode 100644 (file)
index 0000000..953b7f4
--- /dev/null
@@ -0,0 +1,24 @@
+[metadata]
+name = nftables
+version = attr: nftables.NFTABLES_VERSION
+description = Libnftables binding
+author = Netfilter project
+author_email = coreteam@netfilter.org
+url = https://netfilter.org/projects/nftables/index.html
+provides = nftables
+classifiers =
+  Development Status :: 4 - Beta
+  Environment :: Console
+  Intended Audience :: Developers
+  License :: OSI Approved :: GNU General Public License v2 (GPLv2)
+  Operating System :: POSIX :: Linux
+  Programming Language :: Python
+  Topic :: System :: Networking :: Firewalls
+
+[options]
+packages = nftables
+package_dir =
+  nftables = src
+
+[options.package_data]
+nftables = schema.json
index d08b8b129a81ce31090141984b3d40b63e7db405..beda28e821662c8d9fdefee034d83a5d75f9c023 100755 (executable)
@@ -1,24 +1,5 @@
 #!/usr/bin/env python
+
 from setuptools import setup
-from nftables import NFTABLES_VERSION
 
-setup(name='nftables',
-      version=NFTABLES_VERSION,
-      description='Libnftables binding',
-      author='Netfilter project',
-      author_email='coreteam@netfilter.org',
-      url='https://netfilter.org/projects/nftables/index.html',
-      packages=['nftables'],
-      provides=['nftables'],
-      package_dir={'nftables':'src'},
-      package_data={'nftables':['schema.json']},
-      classifiers=[
-          'Development Status :: 4 - Beta',
-          'Environment :: Console',
-          'Intended Audience :: Developers',
-          'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
-          'Operating System :: POSIX :: Linux',
-          'Programming Language :: Python',
-          'Topic :: System :: Networking :: Firewalls',
-          ],
-      )
+setup()