changeset 140:bf77784ee288

Use a declarative setup configuration now in setup.cfg
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 03 Jan 2025 01:06:19 +0100
parents 73e8116484f2
children fdc456832ba6
files setup.cfg setup.py
diffstat 2 files changed, 42 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/setup.cfg	Fri Jan 03 00:35:27 2025 +0100
+++ b/setup.cfg	Fri Jan 03 01:06:19 2025 +0100
@@ -1,6 +1,3 @@
-[metadata]
-license_file = LICENSE.txt
-
 [egg_info]
 tag_build =
 tag_date = 0
@@ -11,3 +8,43 @@
 
 [sdist]
 formats = gztar
+
+[metadata]
+name = py-cutils
+version = attr: cutils.__version__
+description = Pure Python implementation of some coreutils with some extensions
+author = Franz Glasner
+author_email = fzglas.hg@dom66.de
+license = BSD 3-Clause "New" or "Revised" License
+url = https://pypi.dom66.de/simple/py-cutils/
+download_url = https://pypi.dom66.de/simple/py-cutils/
+license_files = LICENSE.txt
+long_description = file: README.txt
+long_description_content_type = text/x-rst
+platforms = any
+classifiers =
+    Development Status :: 5 - Production/Stable
+    Environment :: Console
+    Intended Audience :: Developers
+    Intended Audience :: End Users/Desktop
+    Intended Audience :: System Administrators
+    License :: OSI Approved :: BSD License
+    Operating System :: OS Independent
+    Programming Language :: Python :: 2.7
+    Programming Language :: Python :: 3
+    Topic :: System
+    Topic :: Utilities
+
+[options]
+include_package_data = False
+zip_safe = True
+python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
+packages =
+    cutils
+    cutils.util
+
+[options.entry_points]
+console_scripts =
+    py-dos2unix = cutils.dos2unix:main
+    py-shasum = cutils.shasum:main
+    py-treesum = cutils.treesum:main
--- a/setup.py	Fri Jan 03 00:35:27 2025 +0100
+++ b/setup.py	Fri Jan 03 01:06:19 2025 +0100
@@ -1,61 +1,6 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-import re
-import os
-import sys
-try:
-    from setuptools import setup
-except ImportError:
-    from distutils.core import setup
-
-
-if (sys.version_info[0] < 2) or \
-        ((sys.version_info[0] == 2) and (sys.version_info[1] < 7)):
-    raise ValueError("Need at least Python 2.7")
-
-pkg_root = os.path.dirname(__file__)
-
-_version_re = re.compile(br"^\s*__version__\s*=\s*(\"|')(.*)\1\s*(#.*)?$",
-                         re.MULTILINE)
-
-with open(os.path.join(pkg_root, "cutils", "__init__.py"), "rb") as vf:
-    version = _version_re.search(vf.read()).group(2).decode("utf-8")
-
-with open(os.path.join(pkg_root, "README.txt"), "rt") as rf:
-    long_description = rf.read()
+from setuptools import setup
 
-setup(
-    name="py-cutils",
-    version=version,
-    author="Franz Glasner",
-    license="""BSD 3-Clause "New" or "Revised" License""",
-    url="https://pypi.dom66.de/simple/py-cutils/",
-    description="Pure Python implementation of some coreutils with some extensions",
-    long_description=long_description,
-    packages=["cutils", "cutils.util"],
-    include_package_data=False,
-    zip_safe=True,
-    platforms="any",
-    classifiers=[
-        "Development Status :: 5 - Production/Stable",
-        "Environment :: Console",
-        "Intended Audience :: Developers",
-        "Intended Audience :: End Users/Desktop",
-        "Intended Audience :: System Administrators",
-        "License :: OSI Approved :: BSD License",
-        "Operating System :: OS Independent",
-        "Programming Language :: Python :: 2.7",
-        "Programming Language :: Python :: 3",
-        "Topic :: System",
-        "Topic :: Utilities",
-    ],
-    python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
-    entry_points={
-        "console_scripts": [
-            "py-dos2unix=cutils.dos2unix:main",
-            "py-shasum=cutils.shasum:main",
-            "py-treesum=cutils.treesum:main",
-        ]
-    }
-)
+setup()