예제 #1
0
def osname():
    distname, version, extra = ld.linux_distribution()
    if distname:
        return filename_sanitize('{0}_{1}'.format(distname, version))
    osx_version, empty, arch = platform.mac_ver()
    if osx_version:
        return filename_sanitize('OSX_{0}'.format(osx_version))
    raise RuntimeError('unknown distribution / os')
def osname():
    distname, version, extra = ld.linux_distribution()
    if distname:
        return filename_sanitize('{0}_{1}'.format(distname, version))
    osx_version, empty, arch = platform.mac_ver()
    if osx_version:
        return filename_sanitize('OSX_{0}'.format(osx_version))
    raise RuntimeError('unknown distribution / os')
예제 #3
0
#!/usr/bin/env python

import ld

print 'os_release_info: {0}'.format(ld.os_release_info())
print 'lsb_release_info: {0}'.format(ld.lsb_release_info())
print 'distro_release_info: {0}'.format(ld.distro_release_info())
print 'id: {0}'.format(ld.id())
print 'name: {0}'.format(ld.name())
print 'name_pretty: {0}'.format(ld.name(True))
print 'version: {0}'.format(ld.version())
print 'version_pretty: {0}'.format(ld.version(True))
print 'like: {0}'.format(ld.like())
print 'codename: {0}'.format(ld.codename())
print 'linux_distribution_full: {0}'.format(ld.linux_distribution())
print 'linux_distribution: {0}'.format(ld.linux_distribution(False))
print 'major_version: {0}'.format(ld.major_version())
print 'minor_version: {0}'.format(ld.minor_version())
print 'build_number: {0}'.format(ld.build_number())
예제 #4
0
    def test_global(self):
        # Because the module-level functions use the module-global
        # LinuxDistribution instance, it would influence the tested
        # code too much if we mocked that in order to use the distro
        # specific release files. Instead, we let the functions use
        # the release files of the distro this test runs on, and
        # compare the result of the global functions with the result
        # of the methods on the global LinuxDistribution object.

        self.assertEqual(ld.id(), MODULE_LDI.id())

        self.assertEqual(ld.name(), MODULE_LDI.name(pretty=False))
        self.assertEqual(ld.name(pretty=False), MODULE_LDI.name())
        self.assertEqual(ld.name(pretty=True), MODULE_LDI.name(pretty=True))

        self.assertEqual(ld.version(), MODULE_LDI.version(pretty=False))
        self.assertEqual(ld.version(pretty=False), MODULE_LDI.version())
        self.assertEqual(ld.version(pretty=True),
                         MODULE_LDI.version(pretty=True))
        self.assertEqual(ld.version(), MODULE_LDI.version(best=False))
        self.assertEqual(ld.version(best=False), MODULE_LDI.version())
        self.assertEqual(ld.version(best=True), MODULE_LDI.version(best=True))

        self.assertEqual(ld.version_parts(),
                         MODULE_LDI.version_parts(best=False))
        self.assertEqual(ld.version_parts(best=False),
                         MODULE_LDI.version_parts())
        self.assertEqual(ld.version_parts(best=True),
                         MODULE_LDI.version_parts(best=True))

        self.assertEqual(ld.major_version(),
                         MODULE_LDI.major_version(best=False))
        self.assertEqual(ld.major_version(best=False),
                         MODULE_LDI.major_version())
        self.assertEqual(ld.major_version(best=True),
                         MODULE_LDI.major_version(best=True))

        self.assertEqual(ld.minor_version(),
                         MODULE_LDI.minor_version(best=False))
        self.assertEqual(ld.minor_version(best=False),
                         MODULE_LDI.minor_version())
        self.assertEqual(ld.minor_version(best=True),
                         MODULE_LDI.minor_version(best=True))

        self.assertEqual(ld.build_number(),
                         MODULE_LDI.build_number(best=False))
        self.assertEqual(ld.build_number(best=False),
                         MODULE_LDI.build_number())
        self.assertEqual(ld.build_number(best=True),
                         MODULE_LDI.build_number(best=True))

        self.assertEqual(ld.like(), MODULE_LDI.like())

        self.assertEqual(ld.codename(), MODULE_LDI.codename())

        self.assertEqual(
            ld.linux_distribution(),
            MODULE_LDI.linux_distribution(full_distribution_name=True))
        self.assertEqual(ld.linux_distribution(full_distribution_name=True),
                         MODULE_LDI.linux_distribution())
        self.assertEqual(
            ld.linux_distribution(full_distribution_name=False),
            MODULE_LDI.linux_distribution(full_distribution_name=False))

        self.assertEqual(ld.os_release_info(), MODULE_LDI.os_release_info())

        self.assertEqual(ld.lsb_release_info(), MODULE_LDI.lsb_release_info())

        self.assertEqual(ld.distro_release_info(),
                         MODULE_LDI.distro_release_info())

        self.assertEqual(ld.info(), MODULE_LDI.info())
예제 #5
0
파일: test_ld.py 프로젝트: digideskio/ld
    def test_global(self):
        # Because the module-level functions use the module-global
        # LinuxDistribution instance, it would influence the tested
        # code too much if we mocked that in order to use the distro
        # specific release files. Instead, we let the functions use
        # the release files of the distro this test runs on, and
        # compare the result of the global functions with the result
        # of the methods on the global LinuxDistribution object.

        self.assertEqual(ld.id(),
            MODULE_LDI.id())

        self.assertEqual(ld.name(),
            MODULE_LDI.name(pretty=False))
        self.assertEqual(ld.name(pretty=False),
            MODULE_LDI.name())
        self.assertEqual(ld.name(pretty=True),
            MODULE_LDI.name(pretty=True))

        self.assertEqual(ld.version(),
            MODULE_LDI.version(pretty=False))
        self.assertEqual(ld.version(pretty=False),
            MODULE_LDI.version())
        self.assertEqual(ld.version(pretty=True),
            MODULE_LDI.version(pretty=True))
        self.assertEqual(ld.version(),
            MODULE_LDI.version(best=False))
        self.assertEqual(ld.version(best=False),
            MODULE_LDI.version())
        self.assertEqual(ld.version(best=True),
            MODULE_LDI.version(best=True))

        self.assertEqual(ld.version_parts(),
            MODULE_LDI.version_parts(best=False))
        self.assertEqual(ld.version_parts(best=False),
            MODULE_LDI.version_parts())
        self.assertEqual(ld.version_parts(best=True),
            MODULE_LDI.version_parts(best=True))

        self.assertEqual(ld.major_version(),
            MODULE_LDI.major_version(best=False))
        self.assertEqual(ld.major_version(best=False),
            MODULE_LDI.major_version())
        self.assertEqual(ld.major_version(best=True),
            MODULE_LDI.major_version(best=True))

        self.assertEqual(ld.minor_version(),
            MODULE_LDI.minor_version(best=False))
        self.assertEqual(ld.minor_version(best=False),
            MODULE_LDI.minor_version())
        self.assertEqual(ld.minor_version(best=True),
            MODULE_LDI.minor_version(best=True))

        self.assertEqual(ld.build_number(),
            MODULE_LDI.build_number(best=False))
        self.assertEqual(ld.build_number(best=False),
            MODULE_LDI.build_number())
        self.assertEqual(ld.build_number(best=True),
            MODULE_LDI.build_number(best=True))

        self.assertEqual(ld.like(),
            MODULE_LDI.like())

        self.assertEqual(ld.codename(),
            MODULE_LDI.codename())

        self.assertEqual(ld.linux_distribution(),
            MODULE_LDI.linux_distribution(full_distribution_name=True))
        self.assertEqual(ld.linux_distribution(full_distribution_name=True),
            MODULE_LDI.linux_distribution())
        self.assertEqual(ld.linux_distribution(full_distribution_name=False),
            MODULE_LDI.linux_distribution(full_distribution_name=False))

        self.assertEqual(ld.os_release_info(),
            MODULE_LDI.os_release_info())

        self.assertEqual(ld.lsb_release_info(),
            MODULE_LDI.lsb_release_info())

        self.assertEqual(ld.distro_release_info(),
            MODULE_LDI.distro_release_info())

        self.assertEqual(ld.info(),
            MODULE_LDI.info())
예제 #6
0
#!/usr/bin/env python

import ld

print "os_release_info: {0}".format(ld.os_release_info())
print "lsb_release_info: {0}".format(ld.lsb_release_info())
print "distro_release_info: {0}".format(ld.distro_release_info())
print "id: {0}".format(ld.id())
print "name: {0}".format(ld.name())
print "name_pretty: {0}".format(ld.name(True))
print "version: {0}".format(ld.version())
print "version_pretty: {0}".format(ld.version(True))
print "like: {0}".format(ld.like())
print "codename: {0}".format(ld.codename())
print "linux_distribution_full: {0}".format(ld.linux_distribution())
print "linux_distribution: {0}".format(ld.linux_distribution(False))
print "major_version: {0}".format(ld.major_version())
print "minor_version: {0}".format(ld.minor_version())
print "build_number: {0}".format(ld.build_number())