diff options
author | Qiyu8 <fangchunlin@huawei.com> | 2020-12-14 16:35:01 +0800 |
---|---|---|
committer | Qiyu8 <fangchunlin@huawei.com> | 2020-12-14 16:35:01 +0800 |
commit | 4c7b3d64780c0cdfb8279c978d8b5a411995aee4 (patch) | |
tree | 4f98ed596916b9e8f5404939d7a39b86b6da52e6 | |
parent | 30c01122d2631269fa28f057f6723168b64ca783 (diff) | |
parent | e3722cea8adb7b66084a7edbc6afb978c5521c16 (diff) | |
download | numpy-4c7b3d64780c0cdfb8279c978d8b5a411995aee4.tar.gz |
Merge branch 'master' of github.com:numpy/numpy into einsum-dot
-rw-r--r-- | doc/source/user/basics.rst | 14 | ||||
-rw-r--r-- | doc/source/user/theory.broadcasting.rst | 2 | ||||
-rw-r--r-- | numpy/__init__.pyi | 43 | ||||
-rw-r--r-- | numpy/_version.py | 2 | ||||
-rw-r--r-- | numpy/core/function_base.py | 2 | ||||
-rw-r--r-- | numpy/distutils/fcompiler/gnu.py | 2 | ||||
-rw-r--r-- | numpy/lib/shape_base.py | 4 | ||||
-rw-r--r-- | numpy/ma/core.py | 14 | ||||
-rw-r--r-- | numpy/typing/_array_like.py | 21 | ||||
-rw-r--r-- | numpy/typing/tests/data/fail/array_like.py | 4 | ||||
-rw-r--r-- | numpy/typing/tests/data/pass/array_like.py | 8 | ||||
-rw-r--r-- | numpy/typing/tests/data/pass/dtype.py | 8 | ||||
-rw-r--r-- | numpy/typing/tests/data/pass/flatiter.py | 2 | ||||
-rw-r--r-- | numpy/typing/tests/data/reveal/dtype.py | 8 | ||||
-rw-r--r-- | numpy/typing/tests/data/reveal/flatiter.py | 21 | ||||
-rw-r--r-- | release_requirements.txt | 2 | ||||
-rwxr-xr-x | setup.py | 21 | ||||
-rw-r--r-- | test_requirements.txt | 2 | ||||
-rw-r--r-- | versioneer.py | 4 |
19 files changed, 115 insertions, 69 deletions
diff --git a/doc/source/user/basics.rst b/doc/source/user/basics.rst index e0fc0ece3..66f3f9ee9 100644 --- a/doc/source/user/basics.rst +++ b/doc/source/user/basics.rst @@ -1,14 +1,18 @@ -************ -NumPy basics -************ +****************** +NumPy fundamentals +****************** + +These documents clarify concepts, design decisions, and technical +constraints in NumPy. This is a great place to understand the +fundamental NumPy ideas and philosophy. .. toctree:: :maxdepth: 1 - basics.types basics.creation - basics.io basics.indexing + basics.io + basics.types basics.broadcasting basics.byteswapping basics.rec diff --git a/doc/source/user/theory.broadcasting.rst b/doc/source/user/theory.broadcasting.rst index b37edeacc..a82d78e6c 100644 --- a/doc/source/user/theory.broadcasting.rst +++ b/doc/source/user/theory.broadcasting.rst @@ -69,7 +69,7 @@ numpy on Windows 2000 with one million element arrays. *Figure 1* *In the simplest example of broadcasting, the scalar ``b`` is - stretched to become an array of with the same shape as ``a`` so the shapes + stretched to become an array of same shape as ``a`` so the shapes are compatible for element-by-element multiplication.* diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi index 83afd2e49..cf9b3e86a 100644 --- a/numpy/__init__.pyi +++ b/numpy/__init__.pyi @@ -870,7 +870,7 @@ class dtype(Generic[_DTypeScalar]): @property def alignment(self) -> int: ... @property - def base(self) -> dtype: ... + def base(self: _DType) -> _DType: ... @property def byteorder(self) -> str: ... @property @@ -880,7 +880,7 @@ class dtype(Generic[_DTypeScalar]): @property def fields( self, - ) -> Optional[Mapping[str, Union[Tuple[dtype, int], Tuple[dtype, int, Any]]]]: ... + ) -> Optional[Mapping[str, Union[Tuple[dtype[Any], int], Tuple[dtype[Any], int, Any]]]]: ... @property def flags(self) -> int: ... @property @@ -906,14 +906,14 @@ class dtype(Generic[_DTypeScalar]): @property def ndim(self) -> int: ... @property - def subdtype(self) -> Optional[Tuple[dtype, _Shape]]: ... - def newbyteorder(self, __new_order: _ByteOrder = ...) -> dtype: ... + def subdtype(self: _DType) -> Optional[Tuple[_DType, _Shape]]: ... + def newbyteorder(self: _DType, __new_order: _ByteOrder = ...) -> _DType: ... # Leave str and type for end to avoid having to use `builtins.str` # everywhere. See https://github.com/python/mypy/issues/3775 @property def str(self) -> builtins.str: ... @property - def type(self) -> Type[generic]: ... + def type(self) -> Type[_DTypeScalar]: ... class _flagsobj: aligned: bool @@ -955,24 +955,30 @@ _ArrayLikeInt = Union[ _FlatIterSelf = TypeVar("_FlatIterSelf", bound=flatiter) -class flatiter(Generic[_ArraySelf]): +class flatiter(Generic[_NdArraySubClass]): @property - def base(self) -> _ArraySelf: ... + def base(self) -> _NdArraySubClass: ... @property def coords(self) -> _Shape: ... @property def index(self) -> int: ... - def copy(self) -> _ArraySelf: ... + def copy(self) -> _NdArraySubClass: ... def __iter__(self: _FlatIterSelf) -> _FlatIterSelf: ... - def __next__(self) -> generic: ... + def __next__(self: flatiter[ndarray[Any, dtype[_ScalarType]]]) -> _ScalarType: ... def __len__(self) -> int: ... @overload - def __getitem__(self, key: Union[int, integer]) -> generic: ... + def __getitem__( + self: flatiter[ndarray[Any, dtype[_ScalarType]]], + key: Union[int, integer], + ) -> _ScalarType: ... @overload def __getitem__( self, key: Union[_ArrayLikeInt, slice, ellipsis], - ) -> _ArraySelf: ... - def __array__(self, __dtype: DTypeLike = ...) -> ndarray: ... + ) -> _NdArraySubClass: ... + @overload + def __array__(self: flatiter[ndarray[Any, _DType]], __dtype: None = ...) -> ndarray[Any, _DType]: ... + @overload + def __array__(self, __dtype: DTypeLike) -> ndarray[Any, dtype[Any]]: ... _OrderKACF = Optional[Literal["K", "A", "C", "F"]] _OrderACF = Optional[Literal["A", "C", "F"]] @@ -1004,7 +1010,6 @@ class _ArrayOrScalarCommon: def itemsize(self) -> int: ... @property def nbytes(self) -> int: ... - def __array__(self, __dtype: DTypeLike = ...) -> ndarray: ... def __bool__(self) -> bool: ... def __bytes__(self) -> bytes: ... def __str__(self) -> str: ... @@ -1468,6 +1473,10 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType]): strides: _ShapeLike = ..., order: _OrderKACF = ..., ) -> _ArraySelf: ... + @overload + def __array__(self, __dtype: None = ...) -> ndarray[Any, _DType]: ... + @overload + def __array__(self, __dtype: DTypeLike) -> ndarray[Any, dtype[Any]]: ... @property def ctypes(self) -> _ctypes: ... @property @@ -1481,7 +1490,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType]): def byteswap(self: _ArraySelf, inplace: bool = ...) -> _ArraySelf: ... def fill(self, value: Any) -> None: ... @property - def flat(self: _ArraySelf) -> flatiter[_ArraySelf]: ... + def flat(self: _NdArraySubClass) -> flatiter[_NdArraySubClass]: ... @overload def item(self, *args: int) -> Any: ... @overload @@ -1646,6 +1655,10 @@ _NBit_co2 = TypeVar("_NBit_co2", covariant=True, bound=NBitBase) class generic(_ArrayOrScalarCommon): @abstractmethod def __init__(self, *args: Any, **kwargs: Any) -> None: ... + @overload + def __array__(self: _ScalarType, __dtype: None = ...) -> ndarray[Any, dtype[_ScalarType]]: ... + @overload + def __array__(self, __dtype: DTypeLike) -> ndarray[Any, dtype[Any]]: ... @property def base(self) -> None: ... @property @@ -1658,7 +1671,7 @@ class generic(_ArrayOrScalarCommon): def strides(self) -> Tuple[()]: ... def byteswap(self: _ScalarType, inplace: Literal[False] = ...) -> _ScalarType: ... @property - def flat(self) -> flatiter[ndarray]: ... + def flat(self: _ScalarType) -> flatiter[ndarray[Any, dtype[_ScalarType]]]: ... def item( self: _ScalarType, __args: Union[Literal[0], Tuple[()], Tuple[Literal[0]]] = ..., 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) diff --git a/numpy/core/function_base.py b/numpy/core/function_base.py index 8a1fee99b..e940ac230 100644 --- a/numpy/core/function_base.py +++ b/numpy/core/function_base.py @@ -371,7 +371,7 @@ def geomspace(start, stop, num=50, endpoint=True, dtype=None, axis=0): 6.12323400e-17+1.00000000e+00j, 7.07106781e-01+7.07106781e-01j, 1.00000000e+00+0.00000000e+00j]) - Graphical illustration of ``endpoint`` parameter: + Graphical illustration of `endpoint` parameter: >>> import matplotlib.pyplot as plt >>> N = 10 diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py index 0d9d769c2..68d1501ee 100644 --- a/numpy/distutils/fcompiler/gnu.py +++ b/numpy/distutils/fcompiler/gnu.py @@ -126,7 +126,7 @@ class GnuFCompiler(FCompiler): target = '10.9' s = f'Env. variable MACOSX_DEPLOYMENT_TARGET set to {target}' warnings.warn(s, stacklevel=2) - os.environ['MACOSX_DEPLOYMENT_TARGET'] = target + os.environ['MACOSX_DEPLOYMENT_TARGET'] = str(target) opt.extend(['-undefined', 'dynamic_lookup', '-bundle']) else: opt.append("-shared") diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index cbc4641d8..f0596444e 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -1088,8 +1088,8 @@ def kron(a, b): ----- The function assumes that the number of dimensions of `a` and `b` are the same, if necessary prepending the smallest with ones. - If `a.shape = (r0,r1,..,rN)` and `b.shape = (s0,s1,...,sN)`, - the Kronecker product has shape `(r0*s0, r1*s1, ..., rN*SN)`. + If ``a.shape = (r0,r1,..,rN)`` and ``b.shape = (s0,s1,...,sN)``, + the Kronecker product has shape ``(r0*s0, r1*s1, ..., rN*SN)``. The elements are products of elements from `a` and `b`, organized explicitly by:: diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 4fb7d8c28..d6af22337 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -5439,7 +5439,7 @@ class MaskedArray(ndarray): When the array contains unmasked values at the same extremes of the datatype, the ordering of these values and the masked values is undefined. - fill_value : {var}, optional + fill_value : scalar or None, optional Value used internally for the masked values. If ``fill_value`` is not None, it supersedes ``endwith``. @@ -5497,7 +5497,7 @@ class MaskedArray(ndarray): axis : {None, integer} If None, the index is into the flattened array, otherwise along the specified axis - fill_value : {var}, optional + fill_value : scalar or None, optional Value used to fill in the masked values. If None, the output of minimum_fill_value(self._data) is used instead. out : {None, array}, optional @@ -5543,7 +5543,7 @@ class MaskedArray(ndarray): axis : {None, integer} If None, the index is into the flattened array, otherwise along the specified axis - fill_value : {var}, optional + fill_value : scalar or None, optional Value used to fill in the masked values. If None, the output of maximum_fill_value(self._data) is used instead. out : {None, array}, optional @@ -5594,7 +5594,7 @@ class MaskedArray(ndarray): When the array contains unmasked values sorting at the same extremes of the datatype, the ordering of these values and the masked values is undefined. - fill_value : {var}, optional + fill_value : scalar or None, optional Value used internally for the masked values. If ``fill_value`` is not None, it supersedes ``endwith``. @@ -5665,7 +5665,7 @@ class MaskedArray(ndarray): out : array_like, optional Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. - fill_value : {var}, optional + fill_value : scalar or None, optional Value used to fill in the masked values. If None, use the output of `minimum_fill_value`. keepdims : bool, optional @@ -5799,7 +5799,7 @@ class MaskedArray(ndarray): out : array_like, optional Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. - fill_value : {var}, optional + fill_value : scalar or None, optional Value used to fill in the masked values. If None, use the output of maximum_fill_value(). keepdims : bool, optional @@ -5876,7 +5876,7 @@ class MaskedArray(ndarray): Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary. - fill_value : {var}, optional + fill_value : scalar or None, optional Value used to fill in the masked values. keepdims : bool, optional If this is set to True, the axes which are reduced are left diff --git a/numpy/typing/_array_like.py b/numpy/typing/_array_like.py index a1a604239..63b67b33a 100644 --- a/numpy/typing/_array_like.py +++ b/numpy/typing/_array_like.py @@ -1,7 +1,9 @@ +from __future__ import annotations + import sys -from typing import Any, overload, Sequence, TYPE_CHECKING, Union +from typing import Any, overload, Sequence, TYPE_CHECKING, Union, TypeVar -from numpy import ndarray +from numpy import ndarray, dtype from ._scalars import _ScalarLike from ._dtype_like import DTypeLike @@ -16,12 +18,15 @@ else: else: HAVE_PROTOCOL = True +_DType = TypeVar("_DType", bound="dtype[Any]") + if TYPE_CHECKING or HAVE_PROTOCOL: - class _SupportsArray(Protocol): - @overload - def __array__(self, __dtype: DTypeLike = ...) -> ndarray: ... - @overload - def __array__(self, dtype: DTypeLike = ...) -> ndarray: ... + # The `_SupportsArray` protocol only cares about the default dtype + # (i.e. `dtype=None`) of the to-be returned array. + # Concrete implementations of the protocol are responsible for adding + # any and all remaining overloads + class _SupportsArray(Protocol[_DType]): + def __array__(self, dtype: None = ...) -> ndarray[Any, _DType]: ... else: _SupportsArray = Any @@ -36,5 +41,5 @@ ArrayLike = Union[ _ScalarLike, Sequence[_ScalarLike], Sequence[Sequence[Any]], # TODO: Wait for support for recursive types - _SupportsArray, + "_SupportsArray[Any]", ] diff --git a/numpy/typing/tests/data/fail/array_like.py b/numpy/typing/tests/data/fail/array_like.py index a97e72dc7..3bbd29061 100644 --- a/numpy/typing/tests/data/fail/array_like.py +++ b/numpy/typing/tests/data/fail/array_like.py @@ -11,6 +11,6 @@ x2: ArrayLike = A() # E: Incompatible types in assignment x3: ArrayLike = {1: "foo", 2: "bar"} # E: Incompatible types in assignment scalar = np.int64(1) -scalar.__array__(dtype=np.float64) # E: Unexpected keyword argument +scalar.__array__(dtype=np.float64) # E: No overload variant array = np.array([1]) -array.__array__(dtype=np.float64) # E: Unexpected keyword argument +array.__array__(dtype=np.float64) # E: No overload variant diff --git a/numpy/typing/tests/data/pass/array_like.py b/numpy/typing/tests/data/pass/array_like.py index f85724267..563fc08c7 100644 --- a/numpy/typing/tests/data/pass/array_like.py +++ b/numpy/typing/tests/data/pass/array_like.py @@ -25,13 +25,13 @@ class A: x13: ArrayLike = A() scalar: _SupportsArray = np.int64(1) -scalar.__array__(np.float64) +scalar.__array__(None) array: _SupportsArray = np.array(1) -array.__array__(np.float64) +array.__array__(None) a: _SupportsArray = A() -a.__array__(np.int64) -a.__array__(dtype=np.int64) +a.__array__(None) +a.__array__(dtype=None) # Escape hatch for when you mean to make something like an object # array. diff --git a/numpy/typing/tests/data/pass/dtype.py b/numpy/typing/tests/data/pass/dtype.py index cbae8c078..a97edc302 100644 --- a/numpy/typing/tests/data/pass/dtype.py +++ b/numpy/typing/tests/data/pass/dtype.py @@ -1,5 +1,7 @@ import numpy as np +dtype_obj = np.dtype(np.str_) + np.dtype(dtype=np.int64) np.dtype(int) np.dtype("int") @@ -33,3 +35,9 @@ class Test: np.dtype(Test()) + +# Methods and attributes +dtype_obj.base +dtype_obj.subdtype +dtype_obj.newbyteorder() +dtype_obj.type diff --git a/numpy/typing/tests/data/pass/flatiter.py b/numpy/typing/tests/data/pass/flatiter.py index c0219eb2b..4fdf25299 100644 --- a/numpy/typing/tests/data/pass/flatiter.py +++ b/numpy/typing/tests/data/pass/flatiter.py @@ -12,3 +12,5 @@ a[0] a[[0, 1, 2]] a[...] a[:] +a.__array__() +a.__array__(np.float64) diff --git a/numpy/typing/tests/data/reveal/dtype.py b/numpy/typing/tests/data/reveal/dtype.py index d414f2c49..626a15270 100644 --- a/numpy/typing/tests/data/reveal/dtype.py +++ b/numpy/typing/tests/data/reveal/dtype.py @@ -1,5 +1,7 @@ import numpy as np +dtype_obj: np.dtype[np.str_] + reveal_type(np.dtype(np.float64)) # E: numpy.dtype[numpy.floating[numpy.typing._64Bit]] reveal_type(np.dtype(np.int64)) # E: numpy.dtype[numpy.signedinteger[numpy.typing._64Bit]] @@ -31,3 +33,9 @@ reveal_type(np.dtype("S8")) # E: numpy.dtype # Void reveal_type(np.dtype(("U", 10))) # E: numpy.dtype[numpy.void] + +# Methods and attributes +reveal_type(dtype_obj.base) # E: numpy.dtype[numpy.str_] +reveal_type(dtype_obj.subdtype) # E: Union[Tuple[numpy.dtype[numpy.str_], builtins.tuple[builtins.int]], None] +reveal_type(dtype_obj.newbyteorder()) # E: numpy.dtype[numpy.str_] +reveal_type(dtype_obj.type) # E: Type[numpy.str_] diff --git a/numpy/typing/tests/data/reveal/flatiter.py b/numpy/typing/tests/data/reveal/flatiter.py index 56cdc7a0e..221101ebb 100644 --- a/numpy/typing/tests/data/reveal/flatiter.py +++ b/numpy/typing/tests/data/reveal/flatiter.py @@ -1,14 +1,17 @@ +from typing import Any import numpy as np -a: "np.flatiter[np.ndarray]" +a: np.flatiter[np.ndarray[Any, np.dtype[np.str_]]] -reveal_type(a.base) # E: numpy.ndarray* -reveal_type(a.copy()) # E: numpy.ndarray* +reveal_type(a.base) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] +reveal_type(a.copy()) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] reveal_type(a.coords) # E: tuple[builtins.int] reveal_type(a.index) # E: int -reveal_type(iter(a)) # E: Iterator[numpy.generic*] -reveal_type(next(a)) # E: numpy.generic -reveal_type(a[0]) # E: numpy.generic -reveal_type(a[[0, 1, 2]]) # E: numpy.ndarray* -reveal_type(a[...]) # E: numpy.ndarray* -reveal_type(a[:]) # E: numpy.ndarray* +reveal_type(iter(a)) # E: Iterator[numpy.str_] +reveal_type(next(a)) # E: numpy.str_ +reveal_type(a[0]) # E: numpy.str_ +reveal_type(a[[0, 1, 2]]) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] +reveal_type(a[...]) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] +reveal_type(a[:]) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] +reveal_type(a.__array__()) # E: numpy.ndarray[Any, numpy.dtype[numpy.str_]] +reveal_type(a.__array__(np.float64)) # E: numpy.ndarray[Any, numpy.dtype[Any]] diff --git a/release_requirements.txt b/release_requirements.txt index c24e39c78..805ce9a8a 100644 --- a/release_requirements.txt +++ b/release_requirements.txt @@ -14,4 +14,4 @@ twine # building and notes Paver -towncrier +git+https://github.com/hawkowl/towncrier.git@master @@ -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/test_requirements.txt b/test_requirements.txt index 1b7b696d3..5166ada16 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,5 +1,5 @@ cython==0.29.21 -wheel +wheel<=0.35.1 setuptools<49.2.0 hypothesis==5.41.5 pytest==6.0.2 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) |