本文整理汇总了Python中distro.version方法的典型用法代码示例。如果您正苦于以下问题:Python distro.version方法的具体用法?Python distro.version怎么用?Python distro.version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distro
的用法示例。
在下文中一共展示了distro.version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: condUnshareNet
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def condUnshareNet(unshare_net=True):
if USE_NSPAWN and unshare_net:
try:
unshare(CLONE_NEWNET)
# Set up loopback interface and add default route via loopback in the namespace.
# Missing default route may confuse some software, see
# https://github.com/rpm-software-management/mock/issues/113
ipr = IPRoute()
dev = ipr.link_lookup(ifname='lo')[0]
ipr.link('set', index=dev, state='up')
ipr.route("add", dst="default", gateway="127.0.0.1")
except exception.UnshareFailed:
# IPC and UTS ns are supported since the same kernel version. If this
# fails, there had to be a warning already
pass
except Exception as e: # pylint: disable=broad-except
getLog().warning("network namespace setup failed: %s", e)
示例2: test_cli_with_root_dir_as_json
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_cli_with_root_dir_as_json(self):
import json
root_dir = os.path.join(RESOURCES, 'cli', 'fedora30')
command = [sys.executable, '-m', 'distro', '-j', '--root-dir', root_dir]
desired_output = {
'codename': '',
'id': 'fedora',
'like': '',
'version': '30',
'version_parts': {
'build_number': '',
'major': '30',
'minor': '',
}
}
results = json.loads(self._run(command))
assert desired_output == results
示例3: test_manjaro1512_lsb_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_manjaro1512_lsb_release(self):
self._test_outcome({
'id': 'manjarolinux',
'name': 'ManjaroLinux',
'pretty_name': 'Manjaro Linux',
'version': '15.12',
'pretty_version': '15.12 (Capella)',
'best_version': '15.12',
'codename': 'Capella'
})
# @pytest.mark.xfail
# def test_openelec6_lsb_release(self):
# # TODO: This should be fixed as part of #109 when dealing
# # with distro inconsistencies
# desired_outcome = {
# 'id': 'openelec',
# 'name': 'OpenELEC',
# 'pretty_name': 'OpenELEC (official) - Version: 6.0.3',
# 'version': '6.0.3',
# 'pretty_version': '6.0.3',
# 'best_version': '6.0.3',
# }
# self._test_outcome(desired_outcome)
示例4: test_ubuntu14normal_lsb_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_ubuntu14normal_lsb_release(self):
self._setup_for_distro(os.path.join(TESTDISTROS, 'lsb',
'ubuntu14_normal'))
self.distro = distro.LinuxDistribution(
include_lsb=True,
os_release_file='path-to-non-existing-file',
distro_release_file='path-to-non-existing-file')
desired_outcome = {
'id': 'ubuntu',
'name': 'Ubuntu',
'pretty_name': 'Ubuntu 14.04.3 LTS',
'version': '14.04',
'pretty_version': '14.04 (trusty)',
'best_version': '14.04.3',
'codename': 'trusty'
}
self._test_outcome(desired_outcome)
示例5: test_ubuntu14nomodules_lsb_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_ubuntu14nomodules_lsb_release(self):
self._setup_for_distro(os.path.join(TESTDISTROS, 'lsb',
'ubuntu14_nomodules'))
self.distro = distro.LinuxDistribution(
include_lsb=True,
os_release_file='path-to-non-existing-file',
distro_release_file='path-to-non-existing-file')
desired_outcome = {
'id': 'ubuntu',
'name': 'Ubuntu',
'pretty_name': 'Ubuntu 14.04.3 LTS',
'version': '14.04',
'pretty_version': '14.04 (trusty)',
'best_version': '14.04.3',
'codename': 'trusty'
}
self._test_outcome(desired_outcome)
示例6: test_trailingblanks_lsb_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_trailingblanks_lsb_release(self):
self._setup_for_distro(os.path.join(TESTDISTROS, 'lsb',
'ubuntu14_trailingblanks'))
self.distro = distro.LinuxDistribution(
include_lsb=True,
os_release_file='path-to-non-existing-file',
distro_release_file='path-to-non-existing-file')
desired_outcome = {
'id': 'ubuntu',
'name': 'Ubuntu',
'pretty_name': 'Ubuntu 14.04.3 LTS',
'version': '14.04',
'pretty_version': '14.04 (trusty)',
'best_version': '14.04.3',
'codename': 'trusty'
}
self._test_outcome(desired_outcome)
示例7: test_unknowndistro_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_unknowndistro_release(self):
self._setup_for_distro(os.path.join(TESTDISTROS, 'distro',
'unknowndistro'))
self.distro = distro.LinuxDistribution()
desired_outcome = {
'id': 'unknowndistro',
'name': 'Unknown Distro',
'pretty_name': 'Unknown Distro 1.0 (Unknown Codename)',
'version': '1.0',
'pretty_version': '1.0 (Unknown Codename)',
'best_version': '1.0',
'codename': 'Unknown Codename',
'major_version': '1',
'minor_version': '0'
}
self._test_outcome(desired_outcome)
示例8: test_slackware14_dist_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_slackware14_dist_release(self):
desired_outcome = {
'id': 'slackware',
'name': 'Slackware',
'pretty_name': 'Slackware 14.1',
'version': '14.1',
'pretty_version': '14.1',
'best_version': '14.1',
'major_version': '14',
'minor_version': '1'
}
self._test_outcome(
desired_outcome,
'slackware',
'14',
release_file_suffix='version')
示例9: test_centos5_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_centos5_release(self):
desired_outcome = {
'id': 'centos',
'name': 'CentOS',
'pretty_name': 'CentOS 5.11 (Final)',
'version': '5.11',
'pretty_version': '5.11 (Final)',
'best_version': '5.11',
'codename': 'Final',
'major_version': '5',
'minor_version': '11'
}
self._test_outcome(desired_outcome)
desired_info = {
'id': 'centos',
'name': 'CentOS',
'version_id': '5.11',
'codename': 'Final'
}
self._test_release_file_info('centos-release', desired_info)
示例10: test_centos7_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_centos7_release(self):
desired_outcome = {
'id': 'centos',
'name': 'CentOS Linux',
'pretty_name': 'CentOS Linux 7 (Core)',
'version': '7',
'pretty_version': '7 (Core)',
'best_version': '7.1.1503',
'like': 'rhel fedora',
'codename': 'Core',
'major_version': '7'
}
self._test_outcome(desired_outcome)
desired_info = {
'id': 'centos',
'name': 'CentOS Linux',
'version_id': '7.1.1503',
'codename': 'Core'
}
self._test_release_file_info('centos-release', desired_info)
示例11: test_fedora19_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_fedora19_release(self):
desired_outcome = {
'id': 'fedora',
'name': 'Fedora',
'pretty_name': 'Fedora 19 (Schrödinger’s Cat)',
'version': '19',
'pretty_version': '19 (Schrödinger’s Cat)',
'best_version': '19',
'codename': 'Schrödinger’s Cat',
'major_version': '19'
}
self._test_outcome(desired_outcome)
desired_info = {
'id': 'fedora',
'name': 'Fedora',
'version_id': '19',
'codename': 'Schrödinger’s Cat'
}
self._test_release_file_info('fedora-release', desired_info)
示例12: test_fedora23_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_fedora23_release(self):
desired_outcome = {
'id': 'fedora',
'name': 'Fedora',
'pretty_name': 'Fedora 23 (Twenty Three)',
'version': '23',
'pretty_version': '23 (Twenty Three)',
'best_version': '23',
'codename': 'Twenty Three',
'major_version': '23'
}
self._test_outcome(desired_outcome)
desired_info = {
'id': 'fedora',
'name': 'Fedora',
'version_id': '23',
'codename': 'Twenty Three'
}
self._test_release_file_info('fedora-release', desired_info)
示例13: test_fedora30_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_fedora30_release(self):
desired_outcome = {
'id': 'fedora',
'name': 'Fedora',
'pretty_name': 'Fedora 30 (Thirty)',
'version': '30',
'pretty_version': '30',
'best_version': '30',
'codename': '',
'major_version': '30'
}
self._test_outcome(desired_outcome)
desired_info = {
'id': 'fedora',
'name': 'Fedora',
'version_id': '30',
'codename': 'Thirty'
}
self._test_release_file_info('fedora-release', desired_info)
示例14: test_kvmibm1_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_kvmibm1_release(self):
desired_outcome = {
'id': 'kvmibm',
'name': 'KVM for IBM z Systems',
'pretty_name': 'KVM for IBM z Systems 1.1.1 (Z)',
'version': '1.1.1',
'pretty_version': '1.1.1 (Z)',
'best_version': '1.1.1',
'like': 'rhel fedora',
'codename': 'Z',
'major_version': '1',
'minor_version': '1',
'build_number': '1'
}
self._test_outcome(desired_outcome)
desired_info = {
'id': 'base',
'name': 'KVM for IBM z Systems',
'version_id': '1.1.1',
'codename': 'Z'
}
self._test_release_file_info('base-release', desired_info)
示例15: test_mageia5_release
# 需要导入模块: import distro [as 别名]
# 或者: from distro import version [as 别名]
def test_mageia5_release(self):
desired_outcome = {
'id': 'mageia',
'name': 'Mageia',
'pretty_name': 'Mageia 5',
'version': '5',
'pretty_version': '5 (thornicroft)',
'best_version': '5',
'like': 'mandriva fedora',
# TODO: Codename differs between distro release and lsb_release.
'codename': 'thornicroft',
'major_version': '5'
}
self._test_outcome(desired_outcome)
desired_info = {
'id': 'mageia',
'name': 'Mageia',
'version_id': '5',
'codename': 'Official'
}
self._test_release_file_info('mageia-release', desired_info)