You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2021/05/11 01:12:35 UTC

[tvm] branch main updated: Ignore invalid git tags when running "git describe" in version.py. (#8009)

This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 573dbe1  Ignore invalid git tags when running "git describe" in version.py. (#8009)
573dbe1 is described below

commit 573dbe1e95757a08c5cb99a917edd90fd18b90cd
Author: Leandro Nunes <le...@arm.com>
AuthorDate: Tue May 11 02:12:11 2021 +0100

    Ignore invalid git tags when running "git describe" in version.py. (#8009)
    
    * When using version.py, the presence of tags not conforming
       with vMAJOR.MINOR.REV can potentally cause version.py to
       fallback to the default release tag (currently "0.8.dev0")
    
     * This change makes version.py ignore tags that do not conform
       with vMAJOR.MINOR.REV by using "git describe --match ...".
---
 version.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/version.py b/version.py
index f3af420..2fa0928 100644
--- a/version.py
+++ b/version.py
@@ -62,10 +62,13 @@ def git_describe_version():
     local_ver: str
         Local version (with additional label appended to pub_ver).
 
-    Note
-    ----
-    We follow PEP 440's convention of public version
-    and local versions.
+    Notes
+    -----
+    - We follow PEP 440's convention of public version
+      and local versions.
+    - Only tags conforming to vMAJOR.MINOR.REV (e.g. "v0.7.0")
+      are considered in order to generate the version string.
+      See the use of `--match` in the `git` command below.
 
     Here are some examples:
 
@@ -77,7 +80,7 @@ def git_describe_version():
       after the most recent tag(v0.7.0),
       the git short hash tag of the current commit is 0d07a329e.
     """
-    cmd = ["git", "describe", "--tags"]
+    cmd = ["git", "describe", "--tags", "--match", "v[0-9]*.[0-9]*.[0-9]*"]
     proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=PROJ_ROOT)
     (out, _) = proc.communicate()