File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 11[metadata]
22name = vulnerablecode
3- version = 36.1.0
3+ version = 36.1.2
44license = Apache-2.0 AND CC-BY-SA-4.0
55
66# description must be on ONE line https://github.com/pypa/setuptools/issues/1390
Original file line number Diff line number Diff line change @@ -2005,7 +2005,7 @@ def set_vulnerablecode_version_and_commit(self):
20052005 msg = f"Field vulnerablecode_version already set to { self .vulnerablecode_version } "
20062006 raise ValueError (msg )
20072007
2008- self .vulnerablecode_version = VULNERABLECODE_VERSION
2008+ self .vulnerablecode_version = vulnerablecode . get_git_tag ()
20092009 self .vulnerablecode_commit = vulnerablecode .get_short_commit ()
20102010 self .save (update_fields = ["vulnerablecode_version" , "vulnerablecode_commit" ])
20112011
Original file line number Diff line number Diff line change 1414
1515import git
1616
17- __version__ = "36.1.0 "
17+ __version__ = "36.1.2 "
1818
1919
2020PROJECT_DIR = Path (__file__ ).resolve ().parent
@@ -49,6 +49,29 @@ def get_git_commit_from_version_file():
4949 return
5050
5151
52+ def get_git_tag_from_version_file ():
53+ """Return the tag from the ".VERSION" file."""
54+ version_file = ROOT_DIR / ".VERSION"
55+ if not version_file .exists ():
56+ return
57+
58+ try :
59+ lines = version_file .read_text ().splitlines ()
60+ ref_line = lines [0 ]
61+ if "tag:" in ref_line :
62+ if vcio_tag := ref_line .split ("tag:" )[- 1 ].strip ():
63+ return vcio_tag
64+ except (UnicodeDecodeError ):
65+ return
66+
67+
68+ def get_git_tag ():
69+ """Return the tag from the ".VERSION" file or __version__."""
70+ if vcio_tag := get_git_tag_from_version_file ():
71+ return vcio_tag
72+ return __version__
73+
74+
5275def get_short_commit ():
5376 """
5477 Return the short commit hash from the .VERSION file or from `git describe`
You can’t perform that action at this time.
0 commit comments