Beispiel #1
0
 def fetch(self, url, hash=None):
     self.prefix.log("fetch:", url)
     f = util.retrieve_url(url, self.top_dir)
     if os.path.isfile(f):
         if hash and not util.check_hash(f, hash):
             raise util.BuildError("Hash doesn't match for {0}: {1}".format(url, hash))
         click.echo("Extracting archive {0} ...".format(f))
         util.extract_ar(archive=f, dst=self.top_dir)
     return next(util.get_dirs(self.top_dir))
Beispiel #2
0
 def check(self, f, *args):
     if self.verbose and not f(*args):
         raise util.BuildError('ASSERTION FAILURE: ', ' '.join([str(arg) for arg in args]))
Beispiel #3
0
def size_command(prefix, n):
    pkgs = len(list(util.ls(prefix.get_package_directory(), os.path.isdir)))
    if pkgs != int(n):
        raise util.BuildError(
            "Not the correct number of items: {}".format(pkgs))