コード例 #1
0
ファイル: robustus.py プロジェクト: jjh42/robustus
    def download_compiled_archive(self, package, version):
        """
        Download compiled package archive, look for locations specified using --find-links. Store archive in current
        working folder.
        :param package: package name
        :param version: package version
        :return: path to archive or None if not found
        """

        if self.settings["no_remote_cache"]:
            return None

        if not platform.machine():
            logging.warn('Cannot determine architecture from "platform.machine()".')
            return None

        archive_base_name = "%s-%s-%s" % (package, version, platform.machine())
        logging.info("Searching for compiled package archive %s" % archive_base_name)
        extensions = [".compiled.tar.gz", ".compiled.tar.bz2", ".compiled.zip"]
        for index in self.settings["find_links"]:
            for archive_name in [archive_base_name + ext for ext in extensions]:
                try:
                    download(os.path.join(index, archive_name), archive_name, verbose=self.settings["verbosity"] >= 2)
                    return os.path.abspath(archive_name)
                except urllib2.URLError:
                    pass

        logging.info("Failed to find compiled package archive %s" % archive_base_name)
        return None
コード例 #2
0
ファイル: robustus.py プロジェクト: jjh42/robustus
    def download(self, package, version):
        """
        Download package archive, look for locations specified using --find-links. Store archive in current
        working folder.
        :param package: package name
        :param version: package version
        :return: path to archive
        """
        logging.info("Searching for package archive %s-%s" % (package, version))
        archive_base_name = "%s-%s" % (package, version)
        extensions = [".tar.gz", ".tar.bz2", ".zip"]
        for index in self.settings["find_links"]:
            for archive_name in [archive_base_name + ext for ext in extensions]:
                try:
                    download(os.path.join(index, archive_name), archive_name, verbose=self.settings["verbosity"] >= 2)
                    return os.path.abspath(archive_name)
                except urllib2.URLError:
                    pass

        raise RequirementException("Failed to find package archive %s-%s" % (package, version))