def parse_src_recipe(self, name, url): p, v = parse_src_name(url) for rpath in self.get_recipe_paths(): rp = os.path.normcase(os.path.join(rpath, p, v or '')) if os.path.exists(rp): return PackageSource(name=name or p, recipe=rp) return None
def parse_src_github(self, name, url): p, v = parse_src_name(url, 'HEAD') if '/' in p: url = 'https://github.com/{0}/archive/{1}.tar.gz'.format(p, v) else: url = 'https://github.com/{0}/{0}/archive/{1}.tar.gz'.format(p, v) if name is None: name = p return PackageSource(name=name, url=url)
def parse_pkg_src(self, pkg, start=None, no_recipe=False): if isinstance(pkg, PackageSource): return pkg if isinstance(pkg, PackageBuild): return self.parse_pkg_src(pkg.pkg_src, start) name, url = parse_alias(pkg) self.log('parse_pkg_src:', name, url, pkg) if '://' not in url: return self.parse_src_file(name, url, start) or \ (None if no_recipe else self.parse_src_recipe(name, url)) or \ self.parse_src_github(name, url) return PackageSource(name=name, url=url)
def parse_pkg_src(self, pkg, start=None): if isinstance(pkg, PackageSource): return pkg if isinstance(pkg, PackageBuild): return self.parse_pkg_src(pkg.pkg_src, start) name, url = parse_alias(pkg) self.log('parse_pkg_src:', name, url, pkg) if '://' not in url: f = util.actual_path(url, start) self.log('parse_pkg_src atual_path:', start, f) # f = os.path.abspath(os.path.expanduser(url)) if os.path.exists(f): url = 'file://' + f else: x = url.split('@') p = x[0] v = 'HEAD' if len(x) > 1: v = x[1] if '/' in p: url = 'https://github.com/{0}/archive/{1}.tar.gz'.format(p, v) if name is None: name = p return PackageSource(name=name, url=url)
def parse_src_file(self, name, url, start=None): f = util.actual_path(url, start) self.log('parse_src_file actual_path:', start, f) if os.path.exists(f): return PackageSource(name=name, url='file://' + f) return None