diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2020-12-12 13:11:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-12 13:11:38 -0700 |
commit | 7a42940e610b77cee2f98eb88aed5e66ef6d8c2a (patch) | |
tree | 7f5bc5a6845fb378f1b29ccc5d5637283224d048 | |
parent | fd1b878b62469cc9cdcb80e66bdec9d2949d8133 (diff) | |
parent | ca11e4e2ebde67743c3ce09ccd265ffd855dbf4f (diff) | |
download | numpy-7a42940e610b77cee2f98eb88aed5e66ef6d8c2a.tar.gz |
Merge pull request #17974 from charris/fix-versioneer-dirty
BLD: Fixes for versioneer and setup.py sdist.
-rw-r--r-- | numpy/_version.py | 2 | ||||
-rwxr-xr-x | setup.py | 21 | ||||
-rw-r--r-- | versioneer.py | 4 |
3 files changed, 15 insertions, 12 deletions
diff --git a/numpy/_version.py b/numpy/_version.py index 73f9f5c7f..6605bf4af 100644 --- a/numpy/_version.py +++ b/numpy/_version.py @@ -236,7 +236,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty=", "--always", "--long", "--match", "%s*" % tag_prefix], cwd=root) @@ -47,11 +47,11 @@ if sys.version_info[:2] < (3, 7): # The first version not in the `Programming Language :: Python :: ...` classifiers above if sys.version_info >= (3, 10): + fmt = "NumPy {} may not yet support Python {}.{}." warnings.warn( - f"NumPy {VERSION} may not yet support Python " - f"{sys.version_info.major}.{sys.version_info.minor}.", - RuntimeWarning, - ) + fmt.format(VERSION, *sys.version_info[:2]), + RuntimeWarning) + del fmt # BEFORE importing setuptools, remove MANIFEST. Otherwise it may not be # properly updated when the contents of directories change (true for distutils, @@ -60,8 +60,10 @@ if os.path.exists('MANIFEST'): os.remove('MANIFEST') # We need to import setuptools here in order for it to persist in sys.modules. -# Its presence/absence is used in subclassing setup in numpy/distutils/core.py, -# which may not be the most robust design. +# Its presence/absence is used in subclassing setup in numpy/distutils/core.py. +# However, we need to run the distutils version of sdist, so import that first +# so that it is in sys.modules +import numpy.distutils.command.sdist import setuptools # Initialize cmdclass from versioneer @@ -158,13 +160,14 @@ class concat_license_files(): f.write(self.bsd_text) -sdist_class = cmdclass['sdist'] -class sdist_checked(sdist_class): +# Need to inherit from versioneer version of sdist to get the encoded +# version information. +class sdist_checked(cmdclass['sdist']): """ check submodules on sdist to prevent incomplete tarballs """ def run(self): check_submodules() with concat_license_files(): - sdist_class.run(self) + super().run() def get_build_overrides(): diff --git a/versioneer.py b/versioneer.py index 1040c2189..7a77c5ef7 100644 --- a/versioneer.py +++ b/versioneer.py @@ -647,7 +647,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty=", "--always", "--long", "--match", "%%s*" %% tag_prefix], cwd=root) @@ -1046,7 +1046,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty=", "--always", "--long", "--match", "%s*" % tag_prefix], cwd=root) |