How to use the distro.codename function in distro

To help you get started, we’ve selected a few distro 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 nir0s / distro / tests / test_ld.py View on Github external
self.assertEqual(distro.minor_version(best=False),
            MODULE_DISTROI.minor_version())
        self.assertEqual(distro.minor_version(best=True),
            MODULE_DISTROI.minor_version(best=True))

        self.assertEqual(distro.build_number(),
            MODULE_DISTROI.build_number(best=False))
        self.assertEqual(distro.build_number(best=False),
            MODULE_DISTROI.build_number())
        self.assertEqual(distro.build_number(best=True),
            MODULE_DISTROI.build_number(best=True))

        self.assertEqual(distro.like(),
            MODULE_DISTROI.like())

        self.assertEqual(distro.codename(),
            MODULE_DISTROI.codename())

        self.assertEqual(distro.info(),
            MODULE_DISTROI.info(best=False))
        self.assertEqual(distro.info(best=False),
            MODULE_DISTROI.info())
        self.assertEqual(distro.info(best=True),
            MODULE_DISTROI.info(best=True))
        self.assertEqual(distro.info(),
            MODULE_DISTROI.info(pretty=False))
        self.assertEqual(distro.info(pretty=False),
            MODULE_DISTROI.info())
        self.assertEqual(distro.info(pretty=True),
            MODULE_DISTROI.info(pretty=True))

        self.assertEqual(distro.os_release_info(),
github nir0s / distro / tests / test_distro.py View on Github external
def test_cli(self):
        command = [sys.executable, '-m', 'distro']
        desired_output = 'Name: ' + distro.name(pretty=True)
        distro_version = distro.version(pretty=True)
        distro_codename = distro.codename()
        desired_output += '\n' + 'Version: ' + distro_version
        desired_output += '\n' + 'Codename: ' + distro_codename
        desired_output += '\n'
        assert self._run(command) == desired_output
github fkie-cad / FACT_core / install.py View on Github external
def check_distribution():
    try:
        import distro
    except ImportError:
        errors = subprocess.run('sudo -EH pip3 install distro', shell=True).stderr
        if errors:
            sys.exit('Could not determine the system´s Linux distribution')
        else:
            import distro
    codename = distro.codename().lower()
    if codename in XENIAL_CODE_NAMES:
        logging.debug('Ubuntu 16.04 detected')
        return 'xenial'
    if codename in BIONIC_CODE_NAMES:
        logging.debug('Ubuntu 18.04 detected')
        return 'bionic'
    else:
        sys.exit('Your Distribution ({} {}) is not supported. FACT Installer requires Ubuntu 16.04, Ubuntu 18.04 or compatible!'.format(distro.id(), distro.version()))
github fkie-cad / FACT_core / src / install.py View on Github external
def check_distribution():
    codename = distro.codename().lower()
    if codename in XENIAL_CODE_NAMES:
        logging.debug('Ubuntu 16.04 detected')
        return 'xenial'
    if codename in BIONIC_CODE_NAMES:
        logging.debug('Ubuntu 18.04 detected')
        return 'bionic'
    else:
        sys.exit('Your Distribution ({} {}) is not supported. FACT Installer requires Ubuntu 16.04, Ubuntu 18.04 or compatible!'.format(distro.id(), distro.version()))
github ThomasKluiters / fetchy / fetchy / utils.py View on Github external
def get_distribution_version():
    """
    Function to acquire current Distribution Version

    This function will return the current distribution version
    if the user is running on a Linux machine.
    """
    return distro.codename()
github ursa-labs / ursabot / ursabot / utils.py View on Github external
def detect(cls):
        system = platform.system().lower()
        if system == 'windows':
            dist = 'windows'
            version, *_ = platform.win32_ver()
            codename = None
        elif system == 'darwin':
            dist = 'macos'
            version, *_ = platform.mac_ver()
            codename = None
        else:
            dist = distro.id()
            version = distro.version()
            codename = distro.codename()

        return cls(
            arch=platform.machine(),
            system=system,
            distro=dist,
            version=version,
            codename=codename
        )
github conan-io / conan / conans / client / tools / oss.py View on Github external
def _get_linux_distro_info(self):
        import distro
        self.linux_distro = distro.id()
        self.os_version = Version(distro.version())
        version_name = distro.codename()
        self.os_version_name = version_name if version_name != "n/a" else ""
        if not self.os_version_name and self.linux_distro == "debian":
            self.os_version_name = self.get_debian_version_name(self.os_version)