Пример #1
0
 def download(self, package_name, config):
   if not os.path.exists(PREBUILT_ROOT):
     util.makedirs(PREBUILT_ROOT)
   info = self.packages[(package_name, config)]
   filename = os.path.join(PREBUILT_ROOT, os.path.basename(info['BIN_URL']))
   if os.path.exists(filename):
     try:
       util.verify_hash(filename, info['BIN_SHA1'])
       return filename
     except util.HashVerificationError:
       pass
   util.log('Downloading prebuilt binary ...')
   util.download_file(filename, info['BIN_URL'])
   util.verify_hash(filename, info['BIN_SHA1'])
   return filename
Пример #2
0
    def download_archive(self, force_mirror):
        """Download the archive to the local cache directory.

    Args:
      force_mirror: force downloading from mirror only.
    """
        filename = self.download_location()
        if not filename or os.path.exists(filename):
            return
        util.makedirs(os.path.dirname(filename))

        # Always try the mirror URL first
        mirror_url = self.get_mirror_url()
        try:
            util.download_file(filename, mirror_url)
        except Error as e:
            if not force_mirror:
                # Fall back to the original upstream URL
                util.download_file(filename, self.URL)
            else:
                raise e
Пример #3
0
  def download_archive(self, force_mirror):
    """Download the archive to the local cache directory.

    Args:
      force_mirror: force downloading from mirror only.
    """
    filename = self.download_location()
    if not filename or os.path.exists(filename):
      return
    util.makedirs(os.path.dirname(filename))

    # Always try the mirror URL first
    mirror_url = self.get_mirror_url()
    try:
      util.download_file(filename, mirror_url)
    except Error as e:
      if not force_mirror:
        # Fall back to the original upstream URL
        util.download_file(filename, self.URL)
      else:
        raise e