File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 2020
2121
2222class Cran :
23- def get_download_url (purl : str ):
23+ """
24+ This class handles CRAN PURLs.
25+ """
26+
27+ purl_pattern = "pkg:cran/.*"
28+ base_url = "https://cran.r-project.org"
29+
30+ @classmethod
31+ def get_download_url (cls , purl : str ):
2432 """
2533 Resolve a CRAN PURL to a verified, downloadable source tarball URL.
2634 Tries current contrib first, then Archive.
@@ -29,13 +37,11 @@ def get_download_url(purl: str):
2937 if not p .name or not p .version :
3038 return None
3139
32- current_url = f"https://cran.r-project.org /src/contrib/{ p .name } _{ p .version } .tar.gz"
40+ current_url = f"{ cls . base_url } /src/contrib/{ p .name } _{ p .version } .tar.gz"
3341 if _http_exists (current_url ):
3442 return current_url
3543
36- archive_url = (
37- f"https://cran.r-project.org/src/contrib/Archive/{ p .name } /{ p .name } _{ p .version } .tar.gz"
38- )
44+ archive_url = f"{ cls .base_url } /src/contrib/Archive/{ p .name } /{ p .name } _{ p .version } .tar.gz"
3945 if _http_exists (archive_url ):
4046 return archive_url
4147
You can’t perform that action at this time.
0 commit comments