Пример #1
0
 def _source_for_type(self, type, val, data):
     data = self._coerce_source_data(data)
     if type == "operation":
         return resourcedef.ResourceSource(self, "operation:%s" % val,
                                           **data)
     else:
         return super(ResourceDef, self)._source_for_type(type, val, data)
Пример #2
0
def main(args):
    resdef = resourcedef.ResourceDef("download", {})
    source = resourcedef.ResourceSource(resdef, args.url)
    download_dir = resolver.url_source_download_dir(source)
    util.ensure_dir(download_dir)
    try:
        source_path = pip_util.download_url(source.uri, download_dir)
    except Exception as e:
        _handle_download_error(e, source)
    else:
        sha256 = util.file_sha256(source_path, use_cache=False)
        print("{}  {}".format(sha256, source_path))