Skip to content

Commit 22f705b

Browse files
committed
Extract vcs_url from project_urls.Source
This helps ORT resolve VCS provenance when artifact download fails. Populated from code_view_url Signed-off-by: Kai Hodžić <hodzic.e.k@outlook.com>
1 parent bc23b53 commit 22f705b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/python_inspector/package_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ async def get_pypi_data_from_purl(
9191
homepage_url = info.get("home_page")
9292
project_urls = info.get("project_urls") or {}
9393
code_view_url = get_pypi_codeview_url(project_urls)
94+
vcs_url = None
95+
if code_view_url:
96+
vcs_url = code_view_url.rstrip("/")
97+
if not vcs_url.endswith(".git"):
98+
vcs_url = vcs_url + ".git"
9499
bug_tracking_url = get_pypi_bugtracker_url(project_urls)
95100
python_version = get_python_version_from_env_tag(python_version=environment.python_version)
96101
valid_distribution_urls = []
@@ -197,6 +202,7 @@ def remove_credentials_from_url(url: str):
197202
api_data_url=remove_credentials_from_url(api_url),
198203
bug_tracking_url=bug_tracking_url,
199204
code_view_url=code_view_url,
205+
vcs_url=vcs_url,
200206
license_expression=info.get("license_expression"),
201207
declared_license=get_declared_license(info),
202208
download_url=remove_credentials_from_url(dist_url),

0 commit comments

Comments
 (0)