How to use the distro.like 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(),
            MODULE_DISTROI.minor_version(best=False))
        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),
github nir0s / distro / query_local_distro.py View on Github external
for line in pformat(obj).split('\n'):
        print(4 * ' ' + line)


print('os_release_info:')
pprint(distro.os_release_info())
print('lsb_release_info:')
pprint(distro.lsb_release_info())
print('distro_release_info:')
pprint(distro.distro_release_info())
print('id: {0}'.format(distro.id()))
print('name: {0}'.format(distro.name()))
print('name_pretty: {0}'.format(distro.name(True)))
print('version: {0}'.format(distro.version()))
print('version_pretty: {0}'.format(distro.version(True)))
print('like: {0}'.format(distro.like()))
print('codename: {0}'.format(distro.codename()))
print('linux_distribution_full: {0}'.format(distro.linux_distribution()))
print('linux_distribution: {0}'.format(distro.linux_distribution(False)))
print('major_version: {0}'.format(distro.major_version()))
print('minor_version: {0}'.format(distro.minor_version()))
print('build_number: {0}'.format(distro.build_number()))
github HorlogeSkynet / archey4 / archey / distributions.py View on Github external
return Distributions.WINDOWS

        # Is it a Windows Sub-system Linux (WSL) distribution ?
        # If so, kernel release identifier should keep a trace of it.
        if b'microsoft' in check_output(['uname', '-r']).lower():
            return Distributions.WINDOWS

        # Is `ID` (from `os-release`) well-known and supported ?
        try:
            return Distributions(distro.id())
        except ValueError:
            pass

        # Is any of `ID_LIKE` (from `os-release`) well-known and supported ?
        # See .
        for id_like in distro.like().split(' '):
            try:
                return Distributions(id_like)
            except ValueError:
                pass

        # Nothing of the above matched, let's return `None` and let the caller handle it.
        return None
github iterative / dvc / dvc / analytics.py View on Github external
return {
            "os": "windows",
            "windows_version_build": version.build,
            "windows_version_major": version.major,
            "windows_version_minor": version.minor,
            "windows_version_service_pack": version.service_pack,
        }

    if system == "Darwin":
        return {"os": "mac", "mac_version": platform.mac_ver()[0]}

    if system == "Linux":
        return {
            "os": "linux",
            "linux_distro": distro.id(),
            "linux_distro_like": distro.like(),
            "linux_distro_version": distro.version(),
        }

    # We don't collect data for any other system.
    raise NotImplementedError
github iterative / dvc / dvc / analytics / system_info.py View on Github external
return {
            "os": "windows",
            "windows_version_build": version.build,
            "windows_version_major": version.major,
            "windows_version_minor": version.minor,
            "windows_version_service_pack": version.service_pack,
        }

    if system == "Darwing":
        return {"os": "mac", "mac_version": platform.mac_ver()[0]}

    if system == "Linux":
        return {
            "os": "linux",
            "linux_distro": distro.id(),
            "linux_distro_like": distro.like(),
            "linux_distro_version": distro.version(),
        }

    return {"os": system.lower()}
github iterative / dvc / dvc / analytics.py View on Github external
return {
            "os": "windows",
            "windows_version_build": version.build,
            "windows_version_major": version.major,
            "windows_version_minor": version.minor,
            "windows_version_service_pack": version.service_pack,
        }

    if system == "Darwin":
        return {"os": "mac", "mac_version": platform.mac_ver()[0]}

    if system == "Linux":
        return {
            "os": "linux",
            "linux_distro": distro.id(),
            "linux_distro_like": distro.like(),
            "linux_distro_version": distro.version(),
        }

    return {"os": system.lower()}
github cobbler / cobbler / cobbler / utils.py View on Github external
make = "centos"
        elif "virtuozzo" in distro_name:
            make = "virtuozzo"
        else:
            make = "redhat"
        return make, float(distro_version)

    elif family == "debian":
        if "debian" in distro_name:
            return "debian", float(distro_version)
        elif "ubuntu" in distro_name:
            return "ubuntu", float(distro_version)

    elif family == "suse":
        make = "suse"
        if "suse" not in distro.like():
            make = "unknown"
        return make, float(distro_version)
github siemens / kas / kas / context.py View on Github external
def get_distro_id_base():
        """
            Returns a compatible distro id.
        """
        return distro.like() or distro.id()
github cobbler / cobbler / cobbler / utils.py View on Github external
def get_family():
    """
    Get family of running operating system.

    Family is the base Linux distribution of a Linux distribution, with a set of common
    """

    redhat_list = ("red hat", "redhat", "scientific linux", "fedora", "centos", "virtuozzo")

    distro_name = distro.name().lower()
    for item in redhat_list:
        if item in distro_name:
            return "redhat"
    if "debian" in distro_name or "ubuntu" in distro_name:
        return "debian"
    if "suse" in distro.like():
        return "suse"
    return distro_name