Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Support downloading of symlinked tarballs
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Jan 5, 2018
1 parent a178204 commit 5b8e8dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions build/sage_bootstrap/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,25 @@ def tarball_filename(self):
"""
return self.tarball_pattern.replace('VERSION', self.version)

@property
def tarball_package(self):
"""
Return the canonical package for the tarball
This is almost always equal to ``self`` except if the package
or the ``checksums.ini`` file is a symbolic link. In that case,
the package of the symbolic link is returned.
OUTPUT:
A ``Package`` instance
"""
n = self.__tarball_package_name
if n == self.name:
return self
else:
return type(self)(n)

@property
def version(self):
"""
Expand Down Expand Up @@ -211,6 +230,8 @@ def _init_checksum(self):
self.__sha1 = result.get('sha1', None)
self.__cksum = result.get('cksum', None)
self.__tarball_pattern = result['tarball']
# Name of the directory containing the checksums.ini file
self.__tarball_package_name = os.path.realpath(checksums_ini).split(os.sep)[-2]

VERSION_PATCHLEVEL = re.compile('(?P<version>.*)\.p(?P<patchlevel>[0-9]+)')

Expand Down
2 changes: 1 addition & 1 deletion build/sage_bootstrap/tarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, tarball_name, package=None):
self.__package = None
for pkg in Package.all():
if pkg.tarball_filename == tarball_name:
self.__package = pkg
self.__package = pkg.tarball_package
if self.package is None:
error = 'tarball {0} is not referenced by any Sage package'.format(tarball_name)
log.error(error)
Expand Down

0 comments on commit 5b8e8dd

Please sign in to comment.