From a2c23ec8cd1b232103b75c2578b54e4bf11ec988 Mon Sep 17 00:00:00 2001 From: 12f23eddde <12f23eddde@gmail.com> Date: Thu, 27 Jun 2024 16:21:18 +0800 Subject: [PATCH] fix: project url transform for unlisted sites --- tests/test_objects.py | 7 +++++++ woc/objects.py | 3 +++ woc/wocprofile.default.json | 2 ++ 3 files changed, 12 insertions(+) diff --git a/tests/test_objects.py b/tests/test_objects.py index 4ef1b4f..e90ea21 100644 --- a/tests/test_objects.py +++ b/tests/test_objects.py @@ -245,6 +245,13 @@ def test_project_url(woc): assert project.url == "https://git.code.sf.net/p/peazip" project = Project("gitlab.com_openRGB_openRGB") assert project.url == "https://gitlab.com/openRGB/openRGB" + project = Project("chromium.googlesource.com_chromiumos_platform/factory") + assert project.url == "https://chromium.googlesource.com/chromiumos/platform/factory" + project = Project("greicekcgm_greice_kelli_cristan_goncalves_mota_jamstackalura") + assert ( + project.url + == "https://github.com/greicekcgm/greice_kelli_cristan_goncalves_mota_jamstackalura" + ) def test_project_head(woc): diff --git a/woc/objects.py b/woc/objects.py index 93e8682..9259f17 100644 --- a/woc/objects.py +++ b/woc/objects.py @@ -588,6 +588,9 @@ def _platform_repo(self) -> str: elif prefix in URL_PREFIXES and "_" in body: platform = URL_PREFIXES[prefix] body = body.replace("_", "/", 1) + elif "." in prefix: + platform = prefix + body = body.replace("_", "/", 1) else: platform = "github.com" body = self.key.replace("_", "/", 1) diff --git a/woc/wocprofile.default.json b/woc/wocprofile.default.json index e58780b..dfe90c7 100644 --- a/woc/wocprofile.default.json +++ b/woc/wocprofile.default.json @@ -35,7 +35,9 @@ "cs3": "[compressed]str_str_str" }, "sites": { + "bb": "bitbucket.org", "bitbucket.org": "bitbucket.org", + "gl": "gitlab.com", "gitlab.com": "gitlab.com", "android.googlesource.com": "android.googlesource.com", "bioconductor.org": "bioconductor.org",