summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2017-06-09 12:28:39 -0500
committerGitHub <noreply@github.com>2017-06-09 12:28:39 -0500
commit36b8ea2f928651a53f29c0dae158f70597207173 (patch)
tree6f2261f220d33d06094ad48a0ff1518d872ea68d /lib
parent218992862c436d4e1bd2ecde2d5914ce8fa5b448 (diff)
downloadspack-36b8ea2f928651a53f29c0dae158f70597207173.tar.gz
spack-36b8ea2f928651a53f29c0dae158f70597207173.tar.bz2
spack-36b8ea2f928651a53f29c0dae158f70597207173.tar.xz
spack-36b8ea2f928651a53f29c0dae158f70597207173.zip
Add default list_url for GitLab, BitBucket, and CRAN (#4439)
* Add default list_url for GitLab, BitBucket, and CRAN * Fix flake and doc tests
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/url.py43
1 files changed, 38 insertions, 5 deletions
diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py
index 54b3b74f1b..f20ca1f918 100644
--- a/lib/spack/spack/url.py
+++ b/lib/spack/spack/url.py
@@ -63,16 +63,49 @@ from spack.version import Version
# "path" seemed like the most generic term.
#
def find_list_url(url):
- """Finds a good list URL for the supplied URL. This depends on
- the site. By default, just assumes that a good list URL is the
- dirname of an archive path. For github URLs, this returns the
- URL of the project's releases page.
+ """Finds a good list URL for the supplied URL.
+
+ By default, returns the dirname of the archive path.
+
+ Provides special treatment for the following websites, which have a
+ unique list URL different from the dirname of the download URL:
+
+ ========= =======================================================
+ GitHub https://github.com/<repo>/<name>/releases
+ GitLab https://gitlab.\*/<repo>/<name>/tags
+ BitBucket https://bitbucket.org/<repo>/<name>/downloads/?tab=tags
+ CRAN https://\*.r-project.org/src/contrib/Archive/<name>
+ ========= =======================================================
+
+ Parameters:
+ url (str): The download URL for the package
+
+ Returns:
+ str: The list URL for the package
"""
url_types = [
+ # GitHub
# e.g. https://github.com/llnl/callpath/archive/v1.0.1.tar.gz
(r'(.*github\.com/[^/]+/[^/]+)',
- lambda m: m.group(1) + '/releases')]
+ lambda m: m.group(1) + '/releases'),
+
+ # GitLab
+ # e.g. https://gitlab.dkrz.de/k202009/libaec/uploads/631e85bcf877c2dcaca9b2e6d6526339/libaec-1.0.0.tar.gz
+ (r'(.*gitlab[^/]+/[^/]+/[^/]+)',
+ lambda m: m.group(1) + '/tags'),
+
+ # BitBucket
+ # e.g. https://bitbucket.org/eigen/eigen/get/3.3.3.tar.bz2
+ (r'(.*bitbucket.org/[^/]+/[^/]+)',
+ lambda m: m.group(1) + '/downloads/?tab=tags'),
+
+ # CRAN
+ # e.g. https://cran.r-project.org/src/contrib/Rcpp_0.12.9.tar.gz
+ # e.g. https://cloud.r-project.org/src/contrib/rgl_0.98.1.tar.gz
+ (r'(.*\.r-project\.org/src/contrib)/([^_]+)',
+ lambda m: m.group(1) + '/Archive/' + m.group(2)),
+ ]
for pattern, fun in url_types:
match = re.search(pattern, url)