How to use the pyp2rpm.name_convertor.NameConvertor function in pyp2rpm

To help you get started, we’ve selected a few pyp2rpm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fedora-python / pyp2rpm / tests / test_metadata_extractors.py View on Github external
def setup_method(self, method):
        self.nc = NameConvertor('fedora')
        self.e = []
        for archive in ('plumbum-0.9.0.tar.gz',
                        'pytest-2.2.3.zip',
                        'simpleeval-0.8.7.tar.gz',
                        'coverage_pth-0.0.1.tar.gz'):
            name, version = archive.split('-')
            self.e.append(me.SetupPyMetadataExtractor('{0}{1}'.format(
                self.td_dir, archive), name, self.nc, version[:5]))
github fedora-python / pyp2rpm / tests / test_name_convertor.py View on Github external
def setup_method(self, method):
        self.ncf = NameConvertor('fedora')
        self.ncm = NameConvertor('mageia')
github fedora-python / pyp2rpm / tests / test_metadata_extractors.py View on Github external
def setup_method(self, method):
        self.nc = NameConvertor('fedora')
        self.e = []
        for archive, name, version in [
                ('setuptools-19.6-py2.py3-none-any.whl',
                 'setuptools', '19.6.2'),
                ('py2exe-0.9.2.2-py33.py34-none-any.whl',
                 'py2exe', '0.9.2.2')]:
            self.e.append(me.WheelMetadataExtractor('{0}{1}'.format(
                self.td_dir, archive), name, self.nc, version, venv=False))
github fedora-python / pyp2rpm / tests / test_virtualenv.py View on Github external
def setup_method(self, method):
        self.temp_dir = tempfile.mkdtemp()
        self.venv = VirtualEnv(name=None, version=None,
                               temp_dir=self.temp_dir,
                               name_convertor=NameConvertor(DEFAULT_DISTRO),
                               base_python_version=DEFAULT_PYTHON_VERSION)
github fedora-python / pyp2rpm / pyp2rpm / name_convertor.py View on Github external
def variants_init(self):
        self.variants = {'python_ver_name': None,
                         'pyver_name': None,
                         'name_python_ver': None,
                         'raw_name': None}

    @property
    def best_matching(self):
        return (self.variants['python_ver_name'] or
                self.variants['pyver_name'] or
                self.variants['name_python_ver'] or
                self.variants['raw_name'])


class DandifiedNameConvertor(NameConvertor):
    """Name convertor based on DNF API query, checks if converted
    name of the package exists in Fedora repositories. If it doesn't, searches
    for the correct variant of the name.
    """

    def __init__(self, *args):
        super(DandifiedNameConvertor, self).__init__(*args)
        if dnf is None:
            raise RuntimeError("DandifiedNameConvertor needs an optional "
                               "requirement dnf.")
        with dnf.Base() as base:
            RELEASEVER = dnf.rpm.detect_releasever(base.conf.installroot)
            base.conf.substitutions['releasever'] = RELEASEVER
            base.read_all_repos()
            base.fill_sack()
            self.query = base.sack.query()
github fedora-python / pyp2rpm / pyp2rpm / convertor.py View on Github external
if not hasattr(self, '_name_convertor'):
            name_convertor.NameConvertor.distro = self.distro
            if self.autonc or (self.autonc is None and
                (self.distro == 'fedora' or
                 self.distro == 'mageia')):
                logger.debug("Using AutoProvidesNameConvertor to convert "
                             "names of the packages.")
                self._name_convertor = name_convertor.AutoProvidesNameConvertor(
                    self.distro)
            elif dnf is None:
                logger.warning("Dnf module not found, please dnf install "
                               "python{0}-dnf to improve accuracy of name "
                               "conversion.".format(sys.version[0]))
                logger.debug(
                    "Using NameConvertor to convert names of the packages.")
                self._name_convertor = name_convertor.NameConvertor(
                    self.distro)
            else:
                logger.debug("Using DandifiedNameConvertor to convert names "
                             "of the packages.")
                self._name_convertor = name_convertor.DandifiedNameConvertor(
                    self.distro)
        return self._name_convertor
github fedora-python / pyp2rpm / pyp2rpm / convertor.py View on Github external
def name_convertor(self):
        if not hasattr(self, '_name_convertor'):
            name_convertor.NameConvertor.distro = self.distro
            if self.autonc or (self.autonc is None and
                (self.distro == 'fedora' or
                 self.distro == 'mageia')):
                logger.debug("Using AutoProvidesNameConvertor to convert "
                             "names of the packages.")
                self._name_convertor = name_convertor.AutoProvidesNameConvertor(
                    self.distro)
            elif dnf is None:
                logger.warning("Dnf module not found, please dnf install "
                               "python{0}-dnf to improve accuracy of name "
                               "conversion.".format(sys.version[0]))
                logger.debug(
                    "Using NameConvertor to convert names of the packages.")
                self._name_convertor = name_convertor.NameConvertor(
                    self.distro)
            else: