How to use the distro.major_version 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
MODULE_DISTROI.version(pretty=True))
        self.assertEqual(distro.version(),
            MODULE_DISTROI.version(best=False))
        self.assertEqual(distro.version(best=False),
            MODULE_DISTROI.version())
        self.assertEqual(distro.version(best=True),
            MODULE_DISTROI.version(best=True))

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

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

        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),
github nir0s / distro / tests / test_ld.py View on Github external
MODULE_DISTROI.version(best=False))
        self.assertEqual(distro.version(best=False),
            MODULE_DISTROI.version())
        self.assertEqual(distro.version(best=True),
            MODULE_DISTROI.version(best=True))

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

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

        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),
github yahoo / invirtualenv / invirtualenv_plugins / rpm.py View on Github external
self.config['rpm_package']['cwd'] = os.getcwd()
        self.config['rpm_package']['noarch'] = self.noarch
        description = self.config['global'].get('description', '').strip()
        if not description:
            self.config['global']['description'] = 'No description available'

        basepython = self.config['rpm_package'].get('basepython', '').strip()
        gbasepython = self.config['global'].get('basepython', '').strip()
        if not basepython and gbasepython:
            self.config['rpm_package']['basepython'] = gbasepython
            self.config['global']['basepython'] = gbasepython

        # In some cases distro returns an empty string '' instead of 0, so we can't assume the value returned from
        # the calls to get that information is always an integer.
        try:
            major = int(distro.major_version())
        except ValueError:
            major = 0

        try:
            minor = int(distro.minor_version())
        except ValueError:
            with open('/etc/system-release') as fh:
                try:
                    minor = int(fh.read().strip().split()[3].split('.')[1])
                except (IndexError, ValueError):
                    minor = 0

        self.config['global']['distro.name()'] = distro.name()
        self.config['global']['distro.major_version()'] = major
        self.config['global']['distro.minor_version()'] = minor
github nir0s / distro / query_local_distro.py View on Github external
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()))