Skip to content

Commit 0906377

Browse files
authored
Revert "Use version prefix from github URL"
1 parent 0cba221 commit 0906377

File tree

2 files changed

+0
-74
lines changed

2 files changed

+0
-74
lines changed

conda_forge_tick/update_sources.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -553,34 +553,11 @@ def get_url(self, meta_yaml) -> Optional[str]:
553553

554554
class Github(VersionFromFeed):
555555
name = "Github"
556-
version_prefix = None
557-
558-
def set_version_prefix(self, version: str, split_url: list[str]):
559-
self.version_prefix = self.get_version_prefix(version, split_url)
560-
if self.version_prefix is None:
561-
return
562-
logger.debug(f"Found version prefix from url: {self.version_prefix}")
563-
self.ver_prefix_remove = [self.version_prefix] + self.ver_prefix_remove
564-
565-
def get_version_prefix(self, version: str, split_url: list[str]):
566-
"""Returns prefix for the first split that contains version. If prefix
567-
is empty - returns None."""
568-
r = re.compile(rf"^(.*){version}")
569-
for split in split_url:
570-
match = r.match(split)
571-
if match is not None:
572-
if match.group(1) == "":
573-
return None
574-
return match.group(1)
575-
576-
return None
577556

578557
def get_url(self, meta_yaml) -> Optional[str]:
579558
if "github.com" not in meta_yaml["url"]:
580559
return None
581560
split_url = meta_yaml["url"].lower().split("/")
582-
version = meta_yaml["version"]
583-
self.set_version_prefix(version, split_url)
584561
package_owner = split_url[split_url.index("github.com") + 1]
585562
gh_package_name = split_url[split_url.index("github.com") + 2]
586563
return f"https://github.com/{package_owner}/{gh_package_name}/releases.atom"

tests/test_upstream_versions.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,54 +1643,3 @@ def test_main(
16431643
update_upstream_versions_mock.assert_called_once_with(
16441644
gx, debug=debug, job=3, n_jobs=10, package="testpackage"
16451645
)
1646-
1647-
1648-
@pytest.mark.parametrize(
1649-
"url, version, version_prefix",
1650-
[
1651-
("https://example.com/archs/1.2.3.tar.gz", "1.2.3", None),
1652-
# we don't want any assumptions on non github urls
1653-
("https://example.com/archs/example-1.2.3.tar.gz", "1.2.3", None),
1654-
(
1655-
"https://github.com/example/example/archive/refs/tags/1.2.3.tar.gz",
1656-
"1.2.3",
1657-
None,
1658-
),
1659-
(
1660-
"https://github.com/example/example/archive/refs/tags/example-1.2.3.tar.gz",
1661-
"1.2.3",
1662-
"example-",
1663-
),
1664-
(
1665-
"https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.6/llvm-18.1.6.src.tar.xz",
1666-
"18.1.6",
1667-
"llvmorg-",
1668-
),
1669-
(
1670-
"https://github.com/simplejson/simplejson/releases/download/1.2.3/simplejson-1.2.3.tar.gz",
1671-
"1.2.3",
1672-
None,
1673-
),
1674-
# Test URLs without source version (if any)
1675-
("https://example.com/archs/sources.tar.gz", "1.2.3", None),
1676-
("https://github.com/archs/sources.tar.gz", "1.2.3", None),
1677-
],
1678-
)
1679-
@flaky
1680-
def test_github_version_prefix(url, version, version_prefix, tmpdir):
1681-
gh = Github()
1682-
meta_yaml = LazyJson(os.path.join(tmpdir, "cf-scripts-test.json"))
1683-
with meta_yaml as _meta_yaml:
1684-
_meta_yaml.update(
1685-
{
1686-
"version": version,
1687-
"url": url,
1688-
}
1689-
)
1690-
1691-
gh.get_url(meta_yaml)
1692-
1693-
if version_prefix is None:
1694-
assert gh.version_prefix is None
1695-
else:
1696-
assert gh.version_prefix == version_prefix

0 commit comments

Comments
 (0)