From d5a99bbfdb015be94a8557813034bb66cf3e6b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Cardao?= Date: Tue, 1 Aug 2023 15:16:55 +0200 Subject: [PATCH] Use pyproject.toml instead of old setup.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove src/e3/__init__.py to use: PEP 420 – Implicit Namespace Packages See: https://peps.python.org/pep-0420/ Update tox.ini to run into an isolated build and add `ld` as test dependency. --- pyproject.toml | 66 ++++++++++++++++++++++++++++++++++ setup.py | 89 ---------------------------------------------- src/e3/__init__.py | 3 -- tox.ini | 2 ++ 4 files changed, 68 insertions(+), 92 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py delete mode 100644 src/e3/__init__.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e60f194c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,66 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "e3-core" +version = "22.4" +description = "E3 core. Tools and library for building and testing software" +requires-python = ">=3.9" +license = {text = "GPLv3"} +authors = [{name = "AdaCore", email = "info@adacore.com"}] +keywords = ["AdaCore", "Server", "Production", "SSC", "Supply chain", "Build"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "License :: AdaCore internal", + "Topic :: Software Development :: Build Tool", +] +dependencies = [ + "colorama", + "pyyaml", + "python-dateutil", + "requests", + "requests_toolbelt", + "tqdm", + "stevedore>1.20.0", + "setuptools", +] + +[project.optional-dependencies] +config = ["tomlkit", "typeguard<3.0.0"] +test = ["mock", "pytest-html", "pytest-socket", "ansi2html", "httpretty"] + +[project.urls] +repository = "https://github.com/AdaCore/e3-core" + +[tools.setuptool.package_data] +e3 = ["py.typed", "os/data/rlimit-*"] + +[project.entry-points."e3.anod.sandbox.sandbox_action"] +exec = "e3.anod.sandbox.action:SandBoxExec" +create = "e3.anod.sandbox.action:SandBoxCreate" +show-config = "e3.anod.sandbox.action:SandBoxShowConfiguration" +migrate = "e3.anod.sandbox.migrate:SandBoxMigrate" + +[project.entry-points."e3.event.handler"] +smtp = "e3.event.handler.smtp:SMTPHandler" +logging = "e3.event.handler.logging:LoggingHandler" +file = "e3.event.handler.file:FileHandler" +s3 = "e3.event.handler.s3:S3Handler" + +[project.entry-points."e3.store"] +http-simple-store = "e3.store.backends.http_simple_store:HTTPSimpleStore" + +[project.entry-points."e3.store.cache.backend"] +file-cache = "e3.store.cache.backends.filecache:FileCache" + +[project.entry-points.sandbox_scripts] +anod = "e3.anod.sandbox.scripts:anod" + +[project.entry-points.console_scripts] +e3 = "e3.sys:main" +e3-sandbox = "e3.anod.sandbox.main:main" +e3-pypi-closure = "e3.python.pypiscript:main" diff --git a/setup.py b/setup.py deleted file mode 100644 index b19ffb9c..00000000 --- a/setup.py +++ /dev/null @@ -1,89 +0,0 @@ -from setuptools import setup, find_packages - -import os - -install_requires = [ - "colorama", - "pyyaml", - "python-dateutil", - "requests", - "requests_toolbelt", - "tqdm", - "stevedore>1.20.0", - "setuptools", -] - -extras_require = { - "config": [ - "tomlkit", - # There are some backward incompatible checks in typeguard 3.x - "typeguard<3.0.0", - ], - "test": ["mock", "pytest-html", "pytest-socket", "ansi2html", "httpretty"], -} - -for p in ("darwin", "linux", "linux2", "win32"): - platform_string = ":sys_platform=='%s'" % p - extras_require[platform_string] = ["psutil"] - if p in ("linux", "linux2"): - extras_require[platform_string].append("ld") - -# Get e3 version from the VERSION file. -version_file = os.path.join(os.path.dirname(__file__), "VERSION") -with open(version_file) as f: - e3_version = f.read().strip() - -with open(os.path.join(os.path.dirname(__file__), "README.md")) as f: - long_description = f.read() - -setup( - name="e3-core", - version=e3_version, - url="https://github.com/AdaCore/e3-core", - license="GPLv3", - author="AdaCore", - author_email="info@adacore.com", - description="E3 core. Tools and library for building and testing software", - long_description=long_description, - long_description_content_type="text/markdown", - namespace_packages=["e3"], - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Topic :: Software Development :: Build Tools", - ], - packages=find_packages(where="src"), - package_dir={"": "src"}, - package_data={"e3": ["py.typed", "os/data/rlimit-*"]}, - install_requires=install_requires, - extras_require=extras_require, - entry_points={ - "e3.anod.sandbox.sandbox_action": [ - "exec = e3.anod.sandbox.action:SandBoxExec", - "create = e3.anod.sandbox.action:SandBoxCreate", - "show-config = e3.anod.sandbox.action:SandBoxShowConfiguration", - "migrate = e3.anod.sandbox.migrate:SandBoxMigrate", - ], - "e3.event.handler": [ - "smtp = e3.event.handler.smtp:SMTPHandler", - "logging = e3.event.handler.logging:LoggingHandler", - "file = e3.event.handler.file:FileHandler", - "s3 = e3.event.handler.s3:S3Handler", - ], - "e3.store": [ - "http-simple-store = e3.store.backends.http_simple_store:HTTPSimpleStore" - ], - "e3.store.cache.backend": [ - "file-cache = e3.store.cache.backends.filecache:FileCache" - ], - "sandbox_scripts": ["anod = e3.anod.sandbox.scripts:anod"], - "console_scripts": [ - "e3 = e3.sys:main", - "e3-sandbox = e3.anod.sandbox.main:main", - "e3-pypi-closure = e3.python.pypiscript:main", - ], - }, -) diff --git a/src/e3/__init__.py b/src/e3/__init__.py deleted file mode 100644 index af4a4186..00000000 --- a/src/e3/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from __future__ import annotations - -__import__("pkg_resources").declare_namespace(__name__) diff --git a/tox.ini b/tox.ini index b4542cc2..344f778b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,10 @@ [tox] envlist = py39-cov-xdist +isolated_build = True [testenv] deps = + ld xdist: pytest-xdist[psutil] # ??? needs to be added as a dep of e3-core requests-cache