From 12c182f1acaf8f9404966ebfa97481c907c1a3a6 Mon Sep 17 00:00:00 2001 From: juga Date: Tue, 20 Oct 2020 16:54:56 +0000 Subject: [PATCH] Obtain package version from SCM It can be tested with `python setup.py version`. Note that it's needed to add a tag that conforms semantic versioning. --- setup.cfg | 7 +++++-- setup.py | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 7e82510..105445f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,5 @@ [metadata] name = pEp -#TODO: automate version pull from hg/git -version = 2.2.0-RC1 url = https://pep.foundation download_url = ext_package = pEp @@ -33,6 +31,11 @@ python_requires = >= 3.6 test_suite = tests setup_requires = setuptools >=38.3.0 + # To automatically write the version from a SCM. + # Note: It fails with tags named as `Release_2.2.0-RC0`, because it is + # not conforming to semantic versioning, but it succeed with tags as + # `2.2.0-rc0`. + setuptools_scm install_requires = setuptools >=38.3.0 tests_require = diff --git a/setup.py b/setup.py index 1d563c5..7884d27 100644 --- a/setup.py +++ b/setup.py @@ -223,4 +223,7 @@ setup( cmdclass={ 'build_ext': BuildExtCommand, }, + # While not using a pyproject.toml, support setuptools_scm setup.cfg usage, + # see https://github.com/pypa/setuptools_scm/#setupcfg-usage + use_scm_version=True, )