From 87e97c356fdfd99a25eba22c44d6ef4de36fe889 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Thu, 4 Nov 2021 14:58:24 +0000 Subject: [PATCH] Remove setup.py Includes upgrading the packaging testing. --- pyproject.toml | 8 +++++--- setup.cfg | 8 -------- setup.py | 15 --------------- tox.ini | 31 ++++++++++++++++++------------- 4 files changed, 23 insertions(+), 39 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 721717f..ce03cd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,11 @@ [build-system] requires = [ - "setuptools >= 41.0.0", - "setuptools_scm >= 1.15.0", + "setuptools >= 42.0.0", # required by pyproject+setuptools_scm integration + "setuptools_scm[toml] >= 3.5.0", # required for "no-local-version" scheme "setuptools_scm_git_archive >= 1.0", "wheel", - "pip", ] build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +local_scheme = "no-local-version" diff --git a/setup.cfg b/setup.cfg index b69c567..2d69928 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,3 @@ -[aliases] -dists = clean --all sdist bdist_wheel - [metadata] name = molecule-vagrant url = https://github.com/ansible-community/molecule-vagrant @@ -55,11 +52,6 @@ packages = find: include_package_data = True zip_safe = False -# These are required during `setup.py` run: -setup_requires = - setuptools_scm[toml] >= 1.15.0 - setuptools_scm_git_archive >= 1.0 - # These are required in actual runtime: install_requires = molecule >= 3.2.0a0 diff --git a/setup.py b/setup.py deleted file mode 100644 index 60c3ae3..0000000 --- a/setup.py +++ /dev/null @@ -1,15 +0,0 @@ -# !/usr/bin/env python -import site -import sys - -import setuptools - -# See https://github.com/pypa/pip/issues/7953 -site.ENABLE_USER_SITE = "--user" in sys.argv[1:] - - -if __name__ == "__main__": - setuptools.setup( - use_scm_version={"local_scheme": "no-local-version"}, - setup_requires=["setuptools_scm[toml]>=3.5.0"], - ) diff --git a/tox.ini b/tox.ini index b377948..a796c7d 100644 --- a/tox.ini +++ b/tox.ini @@ -12,10 +12,10 @@ isolated_build = True [testenv] description = Unit testing -usedevelop = True extras = test deps = + --editable . ansible-core py{36,37,38,39}: molecule[test] py{36,37,38,39}-{devel}: git+https://github.com/ansible-community/molecule.git@main#egg=molecule[test] @@ -66,20 +66,25 @@ whitelist_externals = pre-commit [testenv:packaging] -usedevelop = false -skip_install = true +description = + Build package, verify metadata, install package and assert behavior when ansible is missing. deps = - collective.checkdocs >= 0.2 - pep517 >= 0.5.0 - twine >= 2.0.0 + build >= 0.7.0, < 0.8.0 + twine +skip_install = true +# Ref: https://twitter.com/di_codes/status/1044358639081975813 commands = - bash -c "rm -rf {toxinidir}/dist/ {toxinidir}/build/ && mkdir -p {toxinidir}/dist/" - python -m pep517.build \ - --source \ - --binary \ - --out-dir {toxinidir}/dist/ \ - {toxinidir} - twine check dist/* + # build wheel and sdist using PEP-517 + {envpython} -c 'import os.path, shutil, sys; \ + dist_dir = os.path.join("{toxinidir}", "dist"); \ + os.path.isdir(dist_dir) or sys.exit(0); \ + print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \ + shutil.rmtree(dist_dir)' + {envpython} -m build \ + --outdir {toxinidir}/dist/ \ + {toxinidir} + # Validate metadata using twine + twine check --strict {toxinidir}/dist/* [testenv:lint] description = Performs linting, style checks