Python distro.name() Examples
The following are 30
code examples of distro.name().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
distro
, or try the search function
.
Example #1
Source File: install_deps.py From stegoVeritas with GNU General Public License v2.0 | 7 votes |
def main(): dist_name = distro.name().lower() if dist_name in ['ubuntu', 'debian', 'kali', 'debian gnu/linux', 'kali gnu/linux']: debian() elif dist_name == 'fedora': fedora() elif dist_name in ['archlinux', 'arch', 'arch linux', 'manjaro', 'manjaro linux']: archlinux() elif dist_name == 'parrot gnu/linux': parrot() else: logger.error('Unhandled distribution to install deps: {}'.format(dist_name)) logger.error('Please poke me or submit a PR.') return
Example #2
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_rhel6_release(self): desired_outcome = { 'id': 'rhel', 'name': 'Red Hat Enterprise Linux Server', 'pretty_name': 'Red Hat Enterprise Linux Server 6.5 (Santiago)', 'version': '6.5', 'pretty_version': '6.5 (Santiago)', 'best_version': '6.5', 'codename': 'Santiago', 'major_version': '6', 'minor_version': '5' } self._test_outcome(desired_outcome) desired_info = { 'id': 'redhat', 'name': 'Red Hat Enterprise Linux Server', 'version_id': '6.5', 'codename': 'Santiago' } self._test_release_file_info('redhat-release', desired_info)
Example #3
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_scientific7_release(self): desired_outcome = { 'id': 'rhel', 'name': 'Scientific Linux', 'pretty_name': 'Scientific Linux 7.2 (Nitrogen)', 'version': '7.2', 'pretty_version': '7.2 (Nitrogen)', 'best_version': '7.2', 'like': 'fedora', 'codename': 'Nitrogen', 'major_version': '7', 'minor_version': '2', } self._test_outcome(desired_outcome) desired_info = { 'id': 'redhat', 'name': 'Scientific Linux', 'version_id': '7.2', 'codename': 'Nitrogen' } self._test_release_file_info('redhat-release', desired_info)
Example #4
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_scientific6_release(self): desired_outcome = { 'id': 'rhel', 'name': 'Scientific Linux', 'pretty_name': 'Scientific Linux 6.4 (Carbon)', 'version': '6.4', 'pretty_version': '6.4 (Carbon)', 'best_version': '6.4', 'codename': 'Carbon', 'major_version': '6', 'minor_version': '4', } self._test_outcome(desired_outcome) desired_info = { 'id': 'redhat', 'name': 'Scientific Linux', 'version_id': '6.4', 'codename': 'Carbon' } self._test_release_file_info('redhat-release', desired_info)
Example #5
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_gentoo_release(self): desired_outcome = { 'id': 'gentoo', 'name': 'Gentoo', 'pretty_name': 'Gentoo/Linux', 'version': '2.2', 'pretty_version': '2.2', 'best_version': '2.2', 'major_version': '2', 'minor_version': '2', } self._test_outcome(desired_outcome) desired_info = { 'id': 'gentoo', 'name': 'Gentoo Base System', 'version_id': '2.2', } self._test_release_file_info('gentoo-release', desired_info)
Example #6
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_ubuntu14_release(self): desired_outcome = { 'id': 'ubuntu', 'name': 'Ubuntu', 'pretty_name': 'Ubuntu 14.04.3 LTS', 'version': '14.04', 'pretty_version': '14.04 (Trusty Tahr)', 'best_version': '14.04.3', 'like': 'debian', 'codename': 'Trusty Tahr', 'major_version': '14', 'minor_version': '04' } self._test_outcome(desired_outcome) # Test the info from the searched distro release file # Does not have one; /etc/debian_version is not considered a distro # release file: self._test_non_existing_release_file()
Example #7
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_sles12_release(self): desired_outcome = { 'id': 'sles', 'name': 'SLES', 'pretty_name': 'SUSE Linux Enterprise Server 12 SP1', 'version': '12.1', 'pretty_version': '12.1 (n/a)', 'best_version': '12.1', 'codename': 'n/a', 'major_version': '12', 'minor_version': '1' } self._test_outcome(desired_outcome) desired_info = { 'id': 'SuSE', 'name': 'SUSE Linux Enterprise Server', 'version_id': '12', 'codename': 's390x' } self._test_release_file_info('SuSE-release', desired_info)
Example #8
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_slackware14_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) desired_info = { 'id': 'slackware', 'name': 'Slackware', 'version_id': '14.1', } distro_info = self._test_release_file_info( 'slackware-version', desired_info) assert 'codename' not in distro_info
Example #9
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_rhel7_release(self): desired_outcome = { 'id': 'rhel', 'name': 'Red Hat Enterprise Linux Server', 'pretty_name': 'Red Hat Enterprise Linux Server 7.0 (Maipo)', 'version': '7.0', 'pretty_version': '7.0 (Maipo)', 'best_version': '7.0', 'like': 'fedora', 'codename': 'Maipo', 'major_version': '7', 'minor_version': '0' } self._test_outcome(desired_outcome) desired_info = { 'id': 'redhat', 'name': 'Red Hat Enterprise Linux Server', 'version_id': '7.0', 'codename': 'Maipo' } self._test_release_file_info('redhat-release', desired_info)
Example #10
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #11
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_oracle7_release(self): desired_outcome = { 'id': 'oracle', 'name': 'Oracle Linux Server', 'pretty_name': 'Oracle Linux Server 7.5', 'version': '7.5', 'pretty_version': '7.5', 'best_version': '7.5', 'major_version': '7', 'minor_version': '5' } self._test_outcome(desired_outcome) desired_info = { 'id': 'oracle', 'name': 'Oracle Linux Server', 'version_id': '7.5', } distro_info = self._test_release_file_info( 'oracle-release', desired_info) assert 'codename' not in distro_info
Example #12
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_opensuse42_release(self): desired_outcome = { 'id': 'opensuse', 'name': 'openSUSE Leap', 'pretty_name': 'openSUSE Leap 42.1 (x86_64)', 'version': '42.1', 'pretty_version': '42.1 (x86_64)', 'best_version': '42.1', 'like': 'suse', 'codename': 'x86_64', 'major_version': '42', 'minor_version': '1' } self._test_outcome(desired_outcome) desired_info = { 'id': 'SuSE', 'name': 'openSUSE', 'version_id': '42.1', 'codename': 'x86_64' } self._test_release_file_info('SuSE-release', desired_info)
Example #13
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #14
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
def test_manjaro1512_release(self): self._test_outcome({ 'id': 'manjaro', 'name': 'Manjaro Linux', 'pretty_name': 'Manjaro Linux', 'version': '15.12', 'pretty_version': '15.12 (Capella)', 'best_version': '15.12', 'major_version': '15', 'minor_version': '12', 'codename': 'Capella' }) self._test_release_file_info( 'manjaro-release', {'id': 'manjaro', 'name': 'Manjaro Linux'})
Example #15
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #16
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #17
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #18
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #19
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #20
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #21
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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)
Example #22
Source File: test_distro.py From distro with Apache License 2.0 | 6 votes |
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')
Example #23
Source File: test_distro.py From distro with Apache License 2.0 | 5 votes |
def test_cloudlinux5_dist_release(self): # Uses redhat-release only to get information. # The id of 'rhel' can only be fixed with issue #109. desired_outcome = { 'id': 'cloudlinux', 'codename': 'Vladislav Volkov', 'name': 'CloudLinux Server', 'pretty_name': 'CloudLinux Server 5.11 (Vladislav Volkov)', 'version': '5.11', 'pretty_version': '5.11 (Vladislav Volkov)', 'best_version': '5.11', 'major_version': '5', 'minor_version': '11' } self._test_outcome(desired_outcome, 'cloudlinux', '5', 'redhat')
Example #24
Source File: test_distro.py From distro with Apache License 2.0 | 5 votes |
def test_oracle7_dist_release(self): desired_outcome = { 'id': 'oracle', 'name': 'Oracle Linux Server', 'pretty_name': 'Oracle Linux Server 7.5', 'version': '7.5', 'pretty_version': '7.5', 'best_version': '7.5', 'major_version': '7', 'minor_version': '5' } self._test_outcome(desired_outcome, 'oracle', '7')
Example #25
Source File: test_distro.py From distro with Apache License 2.0 | 5 votes |
def test_opensuse42_dist_release(self): desired_outcome = { 'id': 'suse', 'name': 'openSUSE', 'pretty_name': 'openSUSE 42.1 (x86_64)', 'version': '42.1', 'pretty_version': '42.1 (x86_64)', 'best_version': '42.1', 'codename': 'x86_64', 'major_version': '42', 'minor_version': '1' } self._test_outcome(desired_outcome, 'opensuse', '42', 'SuSE')
Example #26
Source File: test_distro.py From distro with Apache License 2.0 | 5 votes |
def test_rhel6_dist_release(self): desired_outcome = { 'id': 'rhel', 'name': 'Red Hat Enterprise Linux Server', 'pretty_name': 'Red Hat Enterprise Linux Server 6.5 (Santiago)', 'version': '6.5', 'pretty_version': '6.5 (Santiago)', 'best_version': '6.5', 'codename': 'Santiago', 'major_version': '6', 'minor_version': '5' } self._test_outcome(desired_outcome, 'rhel', '6', 'redhat')
Example #27
Source File: test_distro.py From distro with Apache License 2.0 | 5 votes |
def test_cloudlinux6_release(self): # Same as above, only has redhat-release. desired_outcome = { 'id': 'cloudlinux', 'codename': 'Oleg Makarov', 'name': 'CloudLinux Server', 'pretty_name': 'CloudLinux Server 6.8 (Oleg Makarov)', 'version': '6.8', 'pretty_version': '6.8 (Oleg Makarov)', 'best_version': '6.8', 'major_version': '6', 'minor_version': '8' } self._test_outcome(desired_outcome)
Example #28
Source File: test_distro.py From distro with Apache License 2.0 | 5 votes |
def test_cloudlinux6_dist_release(self): # Same as above, only has redhat-release. desired_outcome = { 'id': 'cloudlinux', 'codename': 'Oleg Makarov', 'name': 'CloudLinux Server', 'pretty_name': 'CloudLinux Server 6.8 (Oleg Makarov)', 'version': '6.8', 'pretty_version': '6.8 (Oleg Makarov)', 'best_version': '6.8', 'major_version': '6', 'minor_version': '8' } self._test_outcome(desired_outcome, 'cloudlinux', '6', 'redhat')
Example #29
Source File: test_distro.py From distro with Apache License 2.0 | 5 votes |
def test_manjaro1512_dist_release(self): self._test_outcome({ 'id': 'manjaro', 'name': 'Manjaro Linux', 'pretty_name': 'Manjaro Linux', 'version': '', 'codename': '' }, 'manjaro', '1512')
Example #30
Source File: test_distro.py From distro with Apache License 2.0 | 5 votes |
def test_cloudlinux5_release(self): # Uses redhat-release only to get information. # The id of 'rhel' can only be fixed with issue #109. desired_outcome = { 'id': 'cloudlinux', 'codename': 'Vladislav Volkov', 'name': 'CloudLinux Server', 'pretty_name': 'CloudLinux Server 5.11 (Vladislav Volkov)', 'version': '5.11', 'pretty_version': '5.11 (Vladislav Volkov)', 'best_version': '5.11', 'major_version': '5', 'minor_version': '11' } self._test_outcome(desired_outcome)