Exemple #1
0
    def run(self):
        """"""
        # late import because of setup.py
        from gpypi.enamer import Enamer
        from gpypi.ebuild import Ebuild
        from gpypi.config import Config, ConfigManager

        # TODO: configure logging (handlers and stuff)
        self.argparse_config.update({
            'up_pn': self.distribution.get_name(),
            'up_pv': self.distribution.get_version(),
        })

        mgr = ConfigManager.load_from_ini(self.config_file)
        mgr.configs['argparse'] = Config(self.argparse_config)
        mgr.configs['setup_py'] = Config.from_setup_py(Enamer.parse_setup_py(self.distribution))
        ebuild = Ebuild(mgr)
        ebuild.unpacked_dir = os.getcwd()
        to = os.path.join(self.dist_dir, ebuild['p'] + '.ebuild')
        ebuild.create(to)
        print 'ebuild saved to %s' % to
Exemple #2
0
    def run(self):
        """"""
        # late import because of setup.py
        from gpypi.enamer import Enamer
        from gpypi.ebuild import Ebuild
        from gpypi.config import Config, ConfigManager

        # TODO: configure logging (handlers and stuff)
        self.argparse_config.update({
            'up_pn': self.distribution.get_name(),
            'up_pv': self.distribution.get_version(),
        })

        mgr = ConfigManager.load_from_ini(self.config_file)
        mgr.configs['argparse'] = Config(self.argparse_config)
        mgr.configs['setup_py'] = Config.from_setup_py(
            Enamer.parse_setup_py(self.distribution))
        ebuild = Ebuild(mgr)
        ebuild.unpacked_dir = os.getcwd()
        to = os.path.join(self.dist_dir, ebuild['p'] + '.ebuild')
        ebuild.create(to)
        print 'ebuild saved to %s' % to
Exemple #3
0
    def do_ebuild(self):
        """
        Get SRC_URI using PyPI and attempt to create ebuild

        :returns: tuple with exit code and pkg_resources requirement

        """
        #Get proper case for project name:
        (self.package_name,
         versions) = self.pypi.query_versions_pypi(self.package_name)

        if not versions:
            log.error("No package %s on PyPi." % self.package_name)
            return

        if self.version and (self.version not in versions):
            log.error("No package %s for version %s on PyPi." %
                      (self.package_name, self.version))
            return
        else:
            self.version = get_highest_version(versions)

        # TODO: self.options.uri only for first ebuild
        # TODO: make find_uri method configurable
        download_url = self.find_uri()

        log.info('Generating ebuild: %s %s', self.package_name, self.version)
        log.debug('URI from PyPi: %s', download_url)

        self.options.configs['argparse']['uri'] = download_url
        self.options.configs['argparse']['up_pn'] = self.package_name
        self.options.configs['argparse']['up_pv'] = self.version

        ebuild = Ebuild(self.options)
        ebuild.set_metadata(self.query_metadata())

        if self.options.command == 'echo':
            ebuild.print_formatted()
        else:
            ebuild.create()
        return ebuild.requires
Exemple #4
0
    def do_ebuild(self):
        """
        Get SRC_URI using PyPI and attempt to create ebuild

        :returns: tuple with exit code and pkg_resources requirement

        """
        #Get proper case for project name:
        (self.package_name, versions) = self.pypi.query_versions_pypi(self.package_name)

        if not versions:
            log.error("No package %s on PyPi." % self.package_name)
            return

        if self.version and (self.version not in versions):
            log.error("No package %s for version %s on PyPi." % (self.package_name, self.version))
            return
        else:
            self.version = get_highest_version(versions)

        # TODO: self.options.uri only for first ebuild
        # TODO: make find_uri method configurable
        download_url = self.find_uri()

        log.info('Generating ebuild: %s %s', self.package_name, self.version)
        log.debug('URI from PyPi: %s', download_url)

        self.options.configs['argparse']['uri'] = download_url
        self.options.configs['argparse']['up_pn'] = self.package_name
        self.options.configs['argparse']['up_pv'] = self.version

        ebuild = Ebuild(self.options)
        ebuild.set_metadata(self.query_metadata())

        if self.options.command == 'echo':
            ebuild.print_formatted()
        else:
            ebuild.create()
        return ebuild.requires