Skip to content

Commit edc6c92

Browse files
committed
Upload to TestPypi using a pep440 compatible version
Otherwise it fail with "'6.0.1.dev8+g5d1f746' is an invalid value for Version"
1 parent 5d1f746 commit edc6c92

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

setup.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,21 @@
1313

1414
import setuptools
1515

16+
17+
def local_scheme(version):
18+
"""Generate a PEP440 compatible version if PEP440_VERSION is enabled"""
19+
import os
20+
import setuptools_scm.version # only present during setup time
21+
22+
return (
23+
''
24+
if 'PEP440_VERSION' in os.environ
25+
else setuptools_scm.version.get_local_node_and_date(version)
26+
)
27+
28+
1629
if __name__ == '__main__':
17-
setuptools.setup(use_scm_version=True, setup_requires=["setuptools_scm"])
30+
setuptools.setup(
31+
use_scm_version={'local_scheme': local_scheme},
32+
setup_requires=["setuptools_scm"],
33+
)

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ commands=sphinx-build -W -b html doc/source doc/build
2626
[testenv:packaging]
2727
description = Validate project packaging
2828
skip_install = true
29+
setenv =
30+
PEP440_VERSION=true
2931
deps=
3032
check-manifest
3133
commands=

0 commit comments

Comments
 (0)