Skip to content

Commit 735e15e

Browse files
authored
Merge pull request #1895 from aboutcode-org/pull-tag-from-manifest
Get tag from VERSION manifest
2 parents 79f181c + 8f79fc0 commit 735e15e

File tree

5 files changed

+42
-7
lines changed

5 files changed

+42
-7
lines changed

CHANGELOG.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ Release notes
22
=============
33

44

5+
Version v36.1.2
6+
---------------------
7+
8+
- Get tag from VERSION manifest #1895
9+
10+
11+
Version v36.1.1
12+
---------------------
13+
14+
- Update is_active help text in pipeline migration #1887
15+
16+
517
Version v36.1.0
618
---------------------
719

docs/source/user-interface.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ package URL or purl prefix fragment such as
1515

1616
The search by packages is available at the following URL:
1717

18-
`https://public.vulnerablecode.io/packages/search <https://public.vulnerablecode.io/packages/search>`_
18+
`https://public.vulnerablecode.io/packages/search/ <https://public.vulnerablecode.io/packages/search/>`_
1919

2020
How to search by packages:
2121

22-
1. Go to the URL: `https://public.vulnerablecode.io/packages/search <https://public.vulnerablecode.io/packages/search>`_
22+
1. Go to the URL: `https://public.vulnerablecode.io/packages/search/ <https://public.vulnerablecode.io/packages/search/>`_
2323
2. Enter the package URL or purl prefix fragment such as ``pkg:pypi``
2424
or by package name in the search box.
2525
3. Click on the search button.
@@ -46,11 +46,11 @@ fragment of these identifiers like ``CVE-2021``.
4646

4747
The search by vulnerabilities is available at the following URL:
4848

49-
`https://public.vulnerablecode.io/vulnerabilities/search <https://public.vulnerablecode.io/vulnerabilities/search>`_
49+
`https://public.vulnerablecode.io/vulnerabilities/search/ <https://public.vulnerablecode.io/vulnerabilities/search/>`_
5050

5151
How to search by vulnerabilities:
5252

53-
1. Go to the URL: `https://public.vulnerablecode.io/vulnerabilities/search <https://public.vulnerablecode.io/vulnerabilities/search>`_
53+
1. Go to the URL: `https://public.vulnerablecode.io/vulnerabilities/search/ <https://public.vulnerablecode.io/vulnerabilities/search/>`_
5454
2. Enter the VCID, CVE, GHSA, CPEs etc. in the search box.
5555
3. Click on the search button.
5656

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = vulnerablecode
3-
version = 36.1.0
3+
version = 36.1.2
44
license = Apache-2.0 AND CC-BY-SA-4.0
55

66
# description must be on ONE line https://github.com/pypa/setuptools/issues/1390

vulnerabilities/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

vulnerablecode/__init__.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import git
1616

17-
__version__ = "36.1.0"
17+
__version__ = "36.1.2"
1818

1919

2020
PROJECT_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+
5275
def get_short_commit():
5376
"""
5477
Return the short commit hash from the .VERSION file or from `git describe`

0 commit comments

Comments
 (0)