def sync(self): """""" pypi = CheeseShop() for package in pypi.list_packages(): (pn, vers) = pypi.query_versions_pypi(package) for version in vers: # TODO: parse_* will not return anything for correct atoms atom = Enamer.construct_atom(Enamer.parse_pn(pn)[0], self.config.category, Enamer.parse_pv(version[0])) # we skip existing ebuilds if PortageUtils.ebuild_exists(atom): continue try: url = pypi.get_download_urls(pn, version)[0] # TODO: use setuptools way also except IndexError: log.warn('Skipping %s, no download url', atom) else: try: self.config.configs['argparse']['uri'] = url self.config.configs['argparse']['up_pn'] = pn self.config.configs['argparse']['up_pv'] = version gpypi = GPyPI(pn, version, self.config) gpypi.create_ebuilds() except KeyboardInterrupt: raise except: log.exception('Unexpected error occured during ebuild creation:')
def sync(self): """""" pypi = CheeseShop() for package in pypi.list_packages(): (pn, vers) = pypi.query_versions_pypi(package) for version in vers: # TODO: parse_* will not return anything for correct atoms atom = Enamer.construct_atom( Enamer.parse_pn(pn)[0], self.config.category, Enamer.parse_pv(version[0])) # we skip existing ebuilds if PortageUtils.ebuild_exists(atom): continue try: url = pypi.get_download_urls(pn, version)[0] # TODO: use setuptools way also except IndexError: log.warn('Skipping %s, no download url', atom) else: try: self.config.configs['argparse']['uri'] = url self.config.configs['argparse']['up_pn'] = pn self.config.configs['argparse']['up_pv'] = version gpypi = GPyPI(pn, version, self.config) gpypi.create_ebuilds() except KeyboardInterrupt: raise except: log.exception( 'Unexpected error occured during ebuild creation:')
def get_dependencies(self, vanilla_requirements, if_use=None): """ Generate :term:`DEPEND` / :term:`RDEPEND` strings. :param vanilla_requirements: **require_\*** contents from `setup.py` :param if_use: :term:`USE` flag that must be set to download dependencies :type vanilla_requirements: string or list :type if_use: string """ # TODO: DOC: steps to acquire deps requirements = parse_requirements(vanilla_requirements) for req in requirements: extras = req.extras # TODO: extend configuration to support callable configs # TODO: pass metadata from the project_name #category = Enamer.convert_category(req.project_name, {}) category = self.options.category pn = Enamer.parse_pn(req.project_name)[0] or req.project_name # add setuptools dependency for later dependency generating self.add_setuptools_depend(req) log.debug('get_dependencies: pn(%s) category(%s)', pn, category) if not len(req.specs): # No version of requirement was specified so we only add # dev-python/pn self.add_rdepend(Enamer.construct_atom(pn, category, uses=extras, if_use=if_use)) else: comparator, ver = req.specs[0] ver = Enamer.parse_pv(ver)[0] or ver log.debug('get_dependencies: pv(%s)' % ver) if len(req.specs) > 1: # Some packages have more than one comparator, i.e. cherrypy # for turbogears has cherrpy>=2.2,<3.0 which would translate # to portage's =dev-python/cherrypy-2.2* comparator1, ver1 = req.specs[0] comparator2, ver2 = req.specs[1] # TODO: this is a total mess, refactor if comparator1.startswith(">") and \ comparator2.startswith("<"): # we set blocker for <* self.add_rdepend(Enamer.construct_atom(pn, category, ver1, comparator1, uses=extras, if_use=if_use)) self.add_rdepend(Enamer.construct_atom(pn, category, ver2, "!" + comparator2, uses=extras, if_use=if_use)) elif comparator2.startswith(">") and \ comparator1.startswith("<"): self.add_rdepend(Enamer.construct_atom(pn, category, ver2, comparator2, uses=extras, if_use=if_use)) self.add_rdepend(Enamer.construct_atom(pn, category, ver1, "!" + comparator1, uses=extras, if_use=if_use)) else: self['warnings'].add("Couldn't resolve requirements. " "You will need to make sure the RDEPEND for %s is " "correct." % req) self.add_rdepend(Enamer.construct_atom(pn, category, uses=extras, if_use=if_use)) self['warnings'].add("Could not determine dependency: %s" % req) break # Requirement.specs is a list of (comparator,version) tuples if comparator == "==": comparator = "=" atom = Enamer.construct_atom(pn, category, ver, comparator, uses=extras) if PortageUtils.is_valid_atom(atom): self.add_rdepend(Enamer.construct_atom(pn, category, ver, comparator, uses=extras, if_use=if_use)) else: log.debug("Invalid PV in dependency: (Requirement %s) %s", req, atom) installed_pv = PortageUtils.get_installed_ver(Enamer.\ construct_atom(pn, category, uses=extras, if_use=if_use)) if installed_pv: # If we have it installed, use >= installed version self.add_rdepend(Enamer.construct_atom(pn, category, installed_pv, '>=', uses=extras, if_use=if_use)) else: # If package has invalid version and we don't have # an ebuild in portage, just add PN to DEPEND, no # version. self['warnings'].add("Could not determine dependency: %s" % req) self.add_rdepend(Enamer.construct_atom(pn, category, uses=extras, if_use=if_use))
def install(self): """""" self.create() package = Enamer.parse_pn(self.config.up_pn)[0] os.execvp('emerge', ['emerge', '-av', package or self.config.up_pn])
def install(self): """""" self.create() package = Enamer.parse_pn(self.config.up_pn)[0] os.execvp('emerge', ['emerge', '-av', package or self.config.up_pn])