def _init_resdef(self): pkg = yaml.load(self.dist.get_metadata("PACKAGE")) data = pkg.get("resources", {}).get(self.name) if not data: raise ValueError("undefined resource '%s' in %s" % self.name, self.dist) return resourcedef.ResourceDef(self.name, data)
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))
def _init_resdef(self): pkg = yaml.safe_load(self.dist.get_metadata("PACKAGE")) if pkg: data = pkg.get("resources", {}).get(self.name) else: data = None if not data: raise ValueError("undefined resource '%s' in %s" % (self.name, self.dist)) fullname = pkg["package"] + "/" + self.name resdef = resourcedef.ResourceDef(self.name, data, fullname) resdef.dist = self.dist return resdef