Hello community, here is the log from the commit of package python-distro for openSUSE:Factory checked in at 2019-02-26 22:20:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-distro (Old) and /work/SRC/openSUSE:Factory/.python-distro.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-distro" Tue Feb 26 22:20:23 2019 rev:9 rq:679035 version:1.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-distro/python-distro.changes 2019-02-08 12:12:02.169500009 +0100 +++ /work/SRC/openSUSE:Factory/.python-distro.new.28833/python-distro.changes 2019-02-26 22:22:01.762074072 +0100 @@ -1,0 +2,15 @@ +Sun Feb 10 13:29:22 UTC 2019 - Sebastian Wagner <sebix+novell....@sebix.at> + +- Update to version 1.4.0: + * Backward Compatibility: + * Prefer the VERSION_CODENAME field of os-release to parsing it from VERSION [[#230](https://github.com/nir0s/distro/pull/230)] + * Bug Fixes: + * Return _uname_info from the uname_info() method [[#233](https://github.com/nir0s/distro/pull/233)] + * Fixed CloudLinux id discovery [[#234](https://github.com/nir0s/distro/pull/234)] + * Update Oracle matching [[#224](https://github.com/nir0s/distro/pull/224)] + * Docs: + * Distro is the recommended replacement for platform.linux_distribution [[#220](https://github.com/nir0s/distro/pull/220)] + * Release: + * Use Markdown for long description in setup.py [[#219](https://github.com/nir0s/distro/pull/219)] + +------------------------------------------------------------------- Old: ---- distro-1.3.0.tar.gz New: ---- distro-1.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-distro.spec ++++++ --- /var/tmp/diff_new_pack.XW8dst/_old 2019-02-26 22:22:02.382073852 +0100 +++ /var/tmp/diff_new_pack.XW8dst/_new 2019-02-26 22:22:02.386073850 +0100 @@ -20,7 +20,7 @@ %{!?license: %global license %doc} %bcond_without test Name: python-distro -Version: 1.3.0 +Version: 1.4.0 Release: 0 Summary: Linux Distribution - a Linux OS platform information API License: Apache-2.0 @@ -61,7 +61,7 @@ %endif %files %{python_files} -%doc CHANGELOG.md README.md README.rst +%doc CHANGELOG.md README.md %python3_only %{_bindir}/distro %{python_sitelib}/* %%license LICENSE ++++++ distro-1.3.0.tar.gz -> distro-1.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/CHANGELOG.md new/distro-1.4.0/CHANGELOG.md --- old/distro-1.3.0/CHANGELOG.md 2018-05-09 09:44:09.000000000 +0200 +++ new/distro-1.4.0/CHANGELOG.md 2019-02-04 09:56:19.000000000 +0100 @@ -1,3 +1,22 @@ +## 1.4.0 (2019.2.4) + +BACKWARD COMPATIBILITY: +* Prefer the VERSION_CODENAME field of os-release to parsing it from VERSION [[#230](https://github.com/nir0s/distro/pull/230)] + +BUG FIXES: +* Return _uname_info from the uname_info() method [[#233](https://github.com/nir0s/distro/pull/233)] +* Fixed CloudLinux id discovery [[#234](https://github.com/nir0s/distro/pull/234)] +* Update Oracle matching [[#224](https://github.com/nir0s/distro/pull/224)] + +DOCS: +* Update Fedora package link [[#225](https://github.com/nir0s/distro/pull/225)] +* Distro is the recommended replacement for platform.linux_distribution [[#220](https://github.com/nir0s/distro/pull/220)] + +RELEASE: +* Use Markdown for long description in setup.py [[#219](https://github.com/nir0s/distro/pull/219)] + +Additionally, The Python2.6 branch was fixed and rebased on top of master. It is now passing all tests. Thanks [abadger](https://github.com/abadger)! + ## 1.3.0 (2018.05.09) ENHANCEMENTS: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/PKG-INFO new/distro-1.4.0/PKG-INFO --- old/distro-1.3.0/PKG-INFO 2018-05-09 10:20:02.000000000 +0200 +++ new/distro-1.4.0/PKG-INFO 2019-02-04 09:56:28.000000000 +0100 @@ -1,16 +1,151 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: distro -Version: 1.3.0 +Version: 1.4.0 Summary: Distro - an OS platform information API Home-page: https://github.com/nir0s/distro Author: Nir Cohen Author-email: nir...@gmail.com License: Apache License, Version 2.0 -Description-Content-Type: UNKNOWN Description: Distro - an OS platform information API ======================================= - See `Official GitHub repo <https://github.com/nir0s/distro#distro---a-linux-os-platform-information-api>`_. + [![Build Status](https://travis-ci.org/nir0s/distro.svg?branch=master)](https://travis-ci.org/nir0s/distro) + [![Build status](https://ci.appveyor.com/api/projects/status/e812qjk1gf0f74r5/branch/master?svg=true)](https://ci.appveyor.com/project/nir0s/distro/branch/master) + [![PyPI version](http://img.shields.io/pypi/v/distro.svg)](https://pypi.python.org/pypi/distro) + [![Supported Python Versions](https://img.shields.io/pypi/pyversions/distro.svg)](https://img.shields.io/pypi/pyversions/distro.svg) + [![Requirements Status](https://requires.io/github/nir0s/distro/requirements.svg?branch=master)](https://requires.io/github/nir0s/distro/requirements/?branch=master) + [![Code Coverage](https://codecov.io/github/nir0s/distro/coverage.svg?branch=master)](https://codecov.io/github/nir0s/distro?branch=master) + [![Code Quality](https://landscape.io/github/nir0s/distro/master/landscape.svg?style=flat)](https://landscape.io/github/nir0s/distro) + [![Is Wheel](https://img.shields.io/pypi/wheel/distro.svg?style=flat)](https://pypi.python.org/pypi/distro) + [![Latest Github Release](https://readthedocs.org/projects/distro/badge/?version=stable)](http://distro.readthedocs.io/en/latest/) + [![Join the chat at https://gitter.im/nir0s/distro](https://badges.gitter.im/nir0s/distro.svg)](https://gitter.im/nir0s/distro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + `distro` provides information about the + OS distribution it runs on, such as a reliable machine-readable ID, or + version information. + + It is the recommended replacement for Python's original + [`platform.linux_distribution`](https://docs.python.org/3.7/library/platform.html#platform.linux_distribution) + function (which will be removed in Python 3.8). + It also provides much more functionality which isn't necessarily Python bound, + like a command-line interface. + + Distro currently supports Linux and BSD based systems but [Windows and OS X support](https://github.com/nir0s/distro/issues/177) is also planned. + + For Python 2.6 support, see https://github.com/nir0s/distro/tree/python2.6-support + + ## Installation + + Installation of the latest released version from PyPI: + + ```shell + pip install distro + ``` + + Installation of the latest development version: + + ```shell + pip install https://github.com/nir0s/distro/archive/master.tar.gz + ``` + + + ## Usage + + ```bash + $ distro + Name: Antergos Linux + Version: 2015.10 (ISO-Rolling) + Codename: ISO-Rolling + + $ distro -j + { + "codename": "ISO-Rolling", + "id": "antergos", + "like": "arch", + "version": "16.9", + "version_parts": { + "build_number": "", + "major": "16", + "minor": "9" + } + } + + + $ python + >>> import distro + >>> distro.linux_distribution(full_distribution_name=False) + ('centos', '7.1.1503', 'Core') + ``` + + + ## Documentation + + On top of the aforementioned API, several more functions are available. For a complete description of the + API, see the [latest API documentation](http://distro.readthedocs.org/en/latest/). + + ## Background + + An alternative implementation became necessary because Python 3.5 deprecated + this function, and Python 3.8 will remove it altogether. + Its predecessor function `platform.dist` was already deprecated since + Python 2.6 and will also be removed in Python 3.8. + Still, there are many cases in which access to that information is needed. + See [Python issue 1322](https://bugs.python.org/issue1322) for more + information. + + The `distro` package implements a robust and inclusive way of retrieving the + information about a distribution based on new standards and old methods, + namely from these data sources (from high to low precedence): + + * The os-release file `/etc/os-release`, if present. + * The output of the `lsb_release` command, if available. + * The distro release file (`/etc/*(-|_)(release|version)`), if present. + * The `uname` command for BSD based distrubtions. + + + ## Python and Distribution Support + + `distro` is supported and tested on Python 2.7, 3.4+ and PyPy and on + any distribution that provides one or more of the data sources + covered. + + This package is tested with test data that mimics the exact behavior of the data sources of [a number of Linux distributions](https://github.com/nir0s/distro/tree/master/tests/resources/distros). + + + ## Testing + + ```shell + git clone g...@github.com:nir0s/distro.git + cd distro + pip install tox + tox + ``` + + + ## Contributions + + Pull requests are always welcome to deal with specific distributions or just + for general merriment. + + See [CONTRIBUTIONS](https://github.com/nir0s/distro/blob/master/CONTRIBUTING.md) for contribution info. + + Reference implementations for supporting additional distributions and file + formats can be found here: + + * https://github.com/saltstack/salt/blob/develop/salt/grains/core.py#L1172 + * https://github.com/chef/ohai/blob/master/lib/ohai/plugins/linux/platform.rb + * https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py + * https://github.com/puppetlabs/facter/blob/master/lib/src/facts/linux/os_linux.cc + + ## Package manager distributions + + * https://src.fedoraproject.org/rpms/python-distro + * https://www.archlinux.org/packages/community/any/python-distro/ + * https://launchpad.net/ubuntu/+source/python-distro + * https://packages.debian.org/sid/python-distro + * https://packages.gentoo.org/packages/dev-python/distro + * https://pkgs.org/download/python2-distro + * https://slackbuilds.org/repository/14.2/python/python-distro/ Platform: All Classifier: Development Status :: 5 - Production/Stable @@ -30,3 +165,4 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: System :: Operating System +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/README.md new/distro-1.4.0/README.md --- old/distro-1.3.0/README.md 2018-05-09 09:42:11.000000000 +0200 +++ new/distro-1.4.0/README.md 2019-02-04 09:31:26.000000000 +0100 @@ -16,12 +16,16 @@ OS distribution it runs on, such as a reliable machine-readable ID, or version information. -It is a renewed alternative implementation for Python's -original `platform.linux_distribution` function, but it also provides much more -functionality which isn't necessarily Python bound like a command-line interface. +It is the recommended replacement for Python's original +[`platform.linux_distribution`](https://docs.python.org/3.7/library/platform.html#platform.linux_distribution) +function (which will be removed in Python 3.8). +It also provides much more functionality which isn't necessarily Python bound, +like a command-line interface. Distro currently supports Linux and BSD based systems but [Windows and OS X support](https://github.com/nir0s/distro/issues/177) is also planned. +For Python 2.6 support, see https://github.com/nir0s/distro/tree/python2.6-support + ## Installation Installation of the latest released version from PyPI: @@ -74,9 +78,9 @@ ## Background An alternative implementation became necessary because Python 3.5 deprecated -this function, and Python 3.7 is expected to remove it altogether. +this function, and Python 3.8 will remove it altogether. Its predecessor function `platform.dist` was already deprecated since -Python 2.6 and is also expected to be removed in Python 3.7. +Python 2.6 and will also be removed in Python 3.8. Still, there are many cases in which access to that information is needed. See [Python issue 1322](https://bugs.python.org/issue1322) for more information. @@ -127,7 +131,7 @@ ## Package manager distributions -* https://admin.fedoraproject.org/pkgdb/package/rpms/python-distro/ +* https://src.fedoraproject.org/rpms/python-distro * https://www.archlinux.org/packages/community/any/python-distro/ * https://launchpad.net/ubuntu/+source/python-distro * https://packages.debian.org/sid/python-distro diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/README.rst new/distro-1.4.0/README.rst --- old/distro-1.3.0/README.rst 2018-01-21 08:16:43.000000000 +0100 +++ new/distro-1.4.0/README.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -Distro - an OS platform information API -======================================= - -See `Official GitHub repo <https://github.com/nir0s/distro#distro---a-linux-os-platform-information-api>`_. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/distro.egg-info/PKG-INFO new/distro-1.4.0/distro.egg-info/PKG-INFO --- old/distro-1.3.0/distro.egg-info/PKG-INFO 2018-05-09 10:20:02.000000000 +0200 +++ new/distro-1.4.0/distro.egg-info/PKG-INFO 2019-02-04 09:56:28.000000000 +0100 @@ -1,16 +1,151 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: distro -Version: 1.3.0 +Version: 1.4.0 Summary: Distro - an OS platform information API Home-page: https://github.com/nir0s/distro Author: Nir Cohen Author-email: nir...@gmail.com License: Apache License, Version 2.0 -Description-Content-Type: UNKNOWN Description: Distro - an OS platform information API ======================================= - See `Official GitHub repo <https://github.com/nir0s/distro#distro---a-linux-os-platform-information-api>`_. + [![Build Status](https://travis-ci.org/nir0s/distro.svg?branch=master)](https://travis-ci.org/nir0s/distro) + [![Build status](https://ci.appveyor.com/api/projects/status/e812qjk1gf0f74r5/branch/master?svg=true)](https://ci.appveyor.com/project/nir0s/distro/branch/master) + [![PyPI version](http://img.shields.io/pypi/v/distro.svg)](https://pypi.python.org/pypi/distro) + [![Supported Python Versions](https://img.shields.io/pypi/pyversions/distro.svg)](https://img.shields.io/pypi/pyversions/distro.svg) + [![Requirements Status](https://requires.io/github/nir0s/distro/requirements.svg?branch=master)](https://requires.io/github/nir0s/distro/requirements/?branch=master) + [![Code Coverage](https://codecov.io/github/nir0s/distro/coverage.svg?branch=master)](https://codecov.io/github/nir0s/distro?branch=master) + [![Code Quality](https://landscape.io/github/nir0s/distro/master/landscape.svg?style=flat)](https://landscape.io/github/nir0s/distro) + [![Is Wheel](https://img.shields.io/pypi/wheel/distro.svg?style=flat)](https://pypi.python.org/pypi/distro) + [![Latest Github Release](https://readthedocs.org/projects/distro/badge/?version=stable)](http://distro.readthedocs.io/en/latest/) + [![Join the chat at https://gitter.im/nir0s/distro](https://badges.gitter.im/nir0s/distro.svg)](https://gitter.im/nir0s/distro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + `distro` provides information about the + OS distribution it runs on, such as a reliable machine-readable ID, or + version information. + + It is the recommended replacement for Python's original + [`platform.linux_distribution`](https://docs.python.org/3.7/library/platform.html#platform.linux_distribution) + function (which will be removed in Python 3.8). + It also provides much more functionality which isn't necessarily Python bound, + like a command-line interface. + + Distro currently supports Linux and BSD based systems but [Windows and OS X support](https://github.com/nir0s/distro/issues/177) is also planned. + + For Python 2.6 support, see https://github.com/nir0s/distro/tree/python2.6-support + + ## Installation + + Installation of the latest released version from PyPI: + + ```shell + pip install distro + ``` + + Installation of the latest development version: + + ```shell + pip install https://github.com/nir0s/distro/archive/master.tar.gz + ``` + + + ## Usage + + ```bash + $ distro + Name: Antergos Linux + Version: 2015.10 (ISO-Rolling) + Codename: ISO-Rolling + + $ distro -j + { + "codename": "ISO-Rolling", + "id": "antergos", + "like": "arch", + "version": "16.9", + "version_parts": { + "build_number": "", + "major": "16", + "minor": "9" + } + } + + + $ python + >>> import distro + >>> distro.linux_distribution(full_distribution_name=False) + ('centos', '7.1.1503', 'Core') + ``` + + + ## Documentation + + On top of the aforementioned API, several more functions are available. For a complete description of the + API, see the [latest API documentation](http://distro.readthedocs.org/en/latest/). + + ## Background + + An alternative implementation became necessary because Python 3.5 deprecated + this function, and Python 3.8 will remove it altogether. + Its predecessor function `platform.dist` was already deprecated since + Python 2.6 and will also be removed in Python 3.8. + Still, there are many cases in which access to that information is needed. + See [Python issue 1322](https://bugs.python.org/issue1322) for more + information. + + The `distro` package implements a robust and inclusive way of retrieving the + information about a distribution based on new standards and old methods, + namely from these data sources (from high to low precedence): + + * The os-release file `/etc/os-release`, if present. + * The output of the `lsb_release` command, if available. + * The distro release file (`/etc/*(-|_)(release|version)`), if present. + * The `uname` command for BSD based distrubtions. + + + ## Python and Distribution Support + + `distro` is supported and tested on Python 2.7, 3.4+ and PyPy and on + any distribution that provides one or more of the data sources + covered. + + This package is tested with test data that mimics the exact behavior of the data sources of [a number of Linux distributions](https://github.com/nir0s/distro/tree/master/tests/resources/distros). + + + ## Testing + + ```shell + git clone g...@github.com:nir0s/distro.git + cd distro + pip install tox + tox + ``` + + + ## Contributions + + Pull requests are always welcome to deal with specific distributions or just + for general merriment. + + See [CONTRIBUTIONS](https://github.com/nir0s/distro/blob/master/CONTRIBUTING.md) for contribution info. + + Reference implementations for supporting additional distributions and file + formats can be found here: + + * https://github.com/saltstack/salt/blob/develop/salt/grains/core.py#L1172 + * https://github.com/chef/ohai/blob/master/lib/ohai/plugins/linux/platform.rb + * https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py + * https://github.com/puppetlabs/facter/blob/master/lib/src/facts/linux/os_linux.cc + + ## Package manager distributions + + * https://src.fedoraproject.org/rpms/python-distro + * https://www.archlinux.org/packages/community/any/python-distro/ + * https://launchpad.net/ubuntu/+source/python-distro + * https://packages.debian.org/sid/python-distro + * https://packages.gentoo.org/packages/dev-python/distro + * https://pkgs.org/download/python2-distro + * https://slackbuilds.org/repository/14.2/python/python-distro/ Platform: All Classifier: Development Status :: 5 - Production/Stable @@ -30,3 +165,4 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: System :: Operating System +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/distro.egg-info/SOURCES.txt new/distro-1.4.0/distro.egg-info/SOURCES.txt --- old/distro-1.3.0/distro.egg-info/SOURCES.txt 2018-05-09 10:20:02.000000000 +0200 +++ new/distro-1.4.0/distro.egg-info/SOURCES.txt 2019-02-04 09:56:28.000000000 +0100 @@ -5,7 +5,6 @@ MANIFEST.in Makefile README.md -README.rst dev-requirements.txt distro.py query_local_distro.py @@ -56,6 +55,11 @@ tests/resources/distros/fedora23/etc/redhat-release tests/resources/distros/fedora23/etc/system-release tests/resources/distros/fedora23/usr/lib/os-release +tests/resources/distros/fedora30/etc/fedora-release +tests/resources/distros/fedora30/etc/os-release +tests/resources/distros/fedora30/etc/redhat-release +tests/resources/distros/fedora30/etc/system-release +tests/resources/distros/fedora30/usr/lib/os-release tests/resources/distros/freebsd111/bin/uname tests/resources/distros/gentoo/etc/gentoo-release tests/resources/distros/gentoo/etc/os-release @@ -99,6 +103,7 @@ tests/resources/distros/opensuse42/etc/SuSE-release tests/resources/distros/opensuse42/etc/os-release tests/resources/distros/oracle7/etc/oracle-release +tests/resources/distros/oracle7/etc/os-release tests/resources/distros/raspbian7/etc/debian_version tests/resources/distros/raspbian7/etc/os-release tests/resources/distros/raspbian7/etc/os-release.orig @@ -125,6 +130,10 @@ tests/resources/distros/ubuntu14/etc/debian_version tests/resources/distros/ubuntu14/etc/lsb-release tests/resources/distros/ubuntu14/etc/os-release +tests/resources/distros/ubuntu16/bin/lsb_release +tests/resources/distros/ubuntu16/etc/debian_version +tests/resources/distros/ubuntu16/etc/lsb-release +tests/resources/distros/ubuntu16/etc/os-release tests/resources/special/empty-release tests/resources/testdistros/distro/baduname/bin/uname tests/resources/testdistros/distro/unknowndistro/etc/unknowndistro-release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/distro.py new/distro-1.4.0/distro.py --- old/distro-1.3.0/distro.py 2018-01-21 08:16:43.000000000 +0100 +++ new/distro-1.4.0/distro.py 2019-02-04 09:25:26.000000000 +0100 @@ -17,12 +17,12 @@ information about the Linux distribution it runs on, such as a reliable machine-readable distro ID, or version information. -It is a renewed alternative implementation for Python's original +It is the recommended replacement for Python's original :py:func:`platform.linux_distribution` function, but it provides much more functionality. An alternative implementation became necessary because Python -3.5 deprecated this function, and Python 3.7 is expected to remove it -altogether. Its predecessor function :py:func:`platform.dist` was already -deprecated since Python 2.6 and is also expected to be removed in Python 3.7. +3.5 deprecated this function, and Python 3.8 will remove it altogether. +Its predecessor function :py:func:`platform.dist` was already +deprecated since Python 2.6 and will also be removed in Python 3.8. Still, there are many cases in which access to OS distribution information is needed. See `Python issue 1322 <https://bugs.python.org/issue1322>`_ for more information. @@ -48,7 +48,9 @@ #: with blanks translated to underscores. #: #: * Value: Normalized value. -NORMALIZED_OS_ID = {} +NORMALIZED_OS_ID = { + 'ol': 'oracle', # Oracle Enterprise Linux +} #: Translation table for normalizing the "Distributor ID" attribute returned by #: the lsb_release command, for use by the :func:`distro.id` method. @@ -812,10 +814,14 @@ For details, see :func:`distro.codename`. """ - return self.os_release_attr('codename') \ - or self.lsb_release_attr('codename') \ - or self.distro_release_attr('codename') \ - or '' + try: + # Handle os_release specially since distros might purposefully set + # this to empty string to have no codename + return self._os_release_info['codename'] + except KeyError: + return self.lsb_release_attr('codename') \ + or self.distro_release_attr('codename') \ + or '' def info(self, pretty=False, best=False): """ @@ -872,6 +878,7 @@ For details, see :func:`distro.uname_info`. """ + return self._uname_info def os_release_attr(self, attribute): """ @@ -963,23 +970,30 @@ if isinstance(v, bytes): v = v.decode('utf-8') props[k.lower()] = v - if k == 'VERSION': - # this handles cases in which the codename is in - # the `(CODENAME)` (rhel, centos, fedora) format - # or in the `, CODENAME` format (Ubuntu). - codename = re.search(r'(\(\D+\))|,(\s+)?\D+', v) - if codename: - codename = codename.group() - codename = codename.strip('()') - codename = codename.strip(',') - codename = codename.strip() - # codename appears within paranthese. - props['codename'] = codename - else: - props['codename'] = '' else: # Ignore any tokens that are not variable assignments pass + + if 'version_codename' in props: + # os-release added a version_codename field. Use that in + # preference to anything else Note that some distros purposefully + # do not have code names. They should be setting + # version_codename="" + props['codename'] = props['version_codename'] + elif 'ubuntu_codename' in props: + # Same as above but a non-standard field name used on older Ubuntus + props['codename'] = props['ubuntu_codename'] + elif 'version' in props: + # If there is no version_codename, parse it from the version + codename = re.search(r'(\(\D+\))|,(\s+)?\D+', props['version']) + if codename: + codename = codename.group() + codename = codename.strip('()') + codename = codename.strip(',') + codename = codename.strip() + # codename appears within paranthese. + props['codename'] = codename + return props @cached_property @@ -1072,7 +1086,10 @@ # file), because we want to use what was specified as best as # possible. match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename) - if match: + if 'name' in distro_info \ + and 'cloudlinux' in distro_info['name'].lower(): + distro_info['id'] = 'cloudlinux' + elif match: distro_info['id'] = match.group(1) return distro_info else: @@ -1113,6 +1130,8 @@ # The name is always present if the pattern matches self.distro_release_file = filepath distro_info['id'] = match.group(1) + if 'cloudlinux' in distro_info['name'].lower(): + distro_info['id'] = 'cloudlinux' return distro_info return {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/setup.py new/distro-1.4.0/setup.py --- old/distro-1.3.0/setup.py 2018-05-09 09:43:53.000000000 +0200 +++ new/distro-1.4.0/setup.py 2019-02-04 09:56:19.000000000 +0100 @@ -18,7 +18,7 @@ # The following version is parsed by other parts of this package. # Don't change the format of the line, or the variable name. -package_version = "1.3.0" +package_version = "1.4.0" here = os.path.abspath(os.path.dirname(__file__)) @@ -37,7 +37,8 @@ license='Apache License, Version 2.0', platforms='All', description='Distro - an OS platform information API', - long_description=read('README.rst'), + long_description=read('README.md'), + long_description_content_type='text/markdown', py_modules=['distro'], entry_points={ 'console_scripts': [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/fedora30/etc/fedora-release new/distro-1.4.0/tests/resources/distros/fedora30/etc/fedora-release --- old/distro-1.3.0/tests/resources/distros/fedora30/etc/fedora-release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/fedora30/etc/fedora-release 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1 @@ +Fedora release 30 (Thirty) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/fedora30/etc/os-release new/distro-1.4.0/tests/resources/distros/fedora30/etc/os-release --- old/distro-1.3.0/tests/resources/distros/fedora30/etc/os-release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/fedora30/etc/os-release 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1,19 @@ +NAME=Fedora +VERSION="30 (Thirty)" +ID=fedora +VERSION_ID=30 +VERSION_CODENAME="" +PLATFORM_ID="platform:f30" +PRETTY_NAME="Fedora 30 (Thirty)" +ANSI_COLOR="0;34" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:30" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/30/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=30 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=30 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/fedora30/etc/redhat-release new/distro-1.4.0/tests/resources/distros/fedora30/etc/redhat-release --- old/distro-1.3.0/tests/resources/distros/fedora30/etc/redhat-release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/fedora30/etc/redhat-release 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1 @@ +Fedora release 30 (Thirty) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/fedora30/etc/system-release new/distro-1.4.0/tests/resources/distros/fedora30/etc/system-release --- old/distro-1.3.0/tests/resources/distros/fedora30/etc/system-release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/fedora30/etc/system-release 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1 @@ +Fedora release 30 (Thirty) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/fedora30/usr/lib/os-release new/distro-1.4.0/tests/resources/distros/fedora30/usr/lib/os-release --- old/distro-1.3.0/tests/resources/distros/fedora30/usr/lib/os-release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/fedora30/usr/lib/os-release 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1,19 @@ +NAME=Fedora +VERSION="30 (Thirty)" +ID=fedora +VERSION_ID=30 +VERSION_CODENAME="" +PLATFORM_ID="platform:f30" +PRETTY_NAME="Fedora 30 (Thirty)" +ANSI_COLOR="0;34" +LOGO=fedora-logo-icon +CPE_NAME="cpe:/o:fedoraproject:fedora:30" +HOME_URL="https://fedoraproject.org/" +DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/30/system-administrators-guide/" +SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" +BUG_REPORT_URL="https://bugzilla.redhat.com/" +REDHAT_BUGZILLA_PRODUCT="Fedora" +REDHAT_BUGZILLA_PRODUCT_VERSION=30 +REDHAT_SUPPORT_PRODUCT="Fedora" +REDHAT_SUPPORT_PRODUCT_VERSION=30 +PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/oracle7/etc/oracle-release new/distro-1.4.0/tests/resources/distros/oracle7/etc/oracle-release --- old/distro-1.3.0/tests/resources/distros/oracle7/etc/oracle-release 2017-10-11 19:28:18.000000000 +0200 +++ new/distro-1.4.0/tests/resources/distros/oracle7/etc/oracle-release 2019-02-02 20:05:34.000000000 +0100 @@ -1 +1 @@ -Oracle Linux Server release 7.1 \ No newline at end of file +Oracle Linux Server release 7.5 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/oracle7/etc/os-release new/distro-1.4.0/tests/resources/distros/oracle7/etc/os-release --- old/distro-1.3.0/tests/resources/distros/oracle7/etc/os-release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/oracle7/etc/os-release 2019-02-02 20:05:34.000000000 +0100 @@ -0,0 +1,14 @@ +NAME="Oracle Linux Server" +VERSION="7.5" +ID="ol" +VERSION_ID="7.5" +PRETTY_NAME="Oracle Linux Server 7.5" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:oracle:linux:7:5:server" +HOME_URL="https://linux.oracle.com/" +BUG_REPORT_URL="https://bugzilla.oracle.com/" + +ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7" +ORACLE_BUGZILLA_PRODUCT_VERSION=7.5 +ORACLE_SUPPORT_PRODUCT="Oracle Linux" +ORACLE_SUPPORT_PRODUCT_VERSION=7.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/ubuntu16/bin/lsb_release new/distro-1.4.0/tests/resources/distros/ubuntu16/bin/lsb_release --- old/distro-1.3.0/tests/resources/distros/ubuntu16/bin/lsb_release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/ubuntu16/bin/lsb_release 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1,39 @@ +#!/bin/bash +# +# lsb_release command for testing the ld module. +# Only the -a option is supported. +# +# This version of the lsb_release command reads an lsb-release file. +# +# The lsb-release file has the usual format, e.g.: +# DISTRIB_ID=Ubuntu +# DISTRIB_RELEASE=14.04 +# DISTRIB_CODENAME=trusty +# DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS" +# Where each line is optional. If a line is missing, the default value +# will be the empty string. +# + +if [[ "$@" != "-a" ]]; then + echo "Usage: lsb_release -a" + exit 2 +fi + +# Because the PATH is set to just this directory, we cannot use 'dirname' +# or other external programs, but need to use built-in abilities of bash. +LSB_FILE="${0%/*}/../etc/lsb-release" + +if [[ ! -f $LSB_FILE ]]; then + echo "Error: LSB release file does not exist: $LSB_FILE" + exit 1 +fi + +source $LSB_FILE + +echo "No LSB modules are available." +echo "Distributor ID: ${DISTRIB_ID:-}" +echo "Description: ${DISTRIB_DESCRIPTION:-}" +echo "Release: ${DISTRIB_RELEASE:-}" +echo "Codename: ${DISTRIB_CODENAME:-}" + +exit 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/ubuntu16/etc/debian_version new/distro-1.4.0/tests/resources/distros/ubuntu16/etc/debian_version --- old/distro-1.3.0/tests/resources/distros/ubuntu16/etc/debian_version 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/ubuntu16/etc/debian_version 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1 @@ +stretch/sid diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/ubuntu16/etc/lsb-release new/distro-1.4.0/tests/resources/distros/ubuntu16/etc/lsb-release --- old/distro-1.3.0/tests/resources/distros/ubuntu16/etc/lsb-release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/ubuntu16/etc/lsb-release 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1,4 @@ +DISTRIB_ID=Ubuntu +DISTRIB_RELEASE=16.04 +DISTRIB_CODENAME=xenial +DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/resources/distros/ubuntu16/etc/os-release new/distro-1.4.0/tests/resources/distros/ubuntu16/etc/os-release --- old/distro-1.3.0/tests/resources/distros/ubuntu16/etc/os-release 1970-01-01 01:00:00.000000000 +0100 +++ new/distro-1.4.0/tests/resources/distros/ubuntu16/etc/os-release 2019-02-04 09:25:26.000000000 +0100 @@ -0,0 +1,10 @@ +NAME="Ubuntu" +VERSION="16.04.1 LTS (Xenial Xerus)" +ID=ubuntu +ID_LIKE=debian +PRETTY_NAME="Ubuntu 16.04.1 LTS" +VERSION_ID="16.04" +HOME_URL="http://www.ubuntu.com/" +SUPPORT_URL="http://help.ubuntu.com/" +BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" +UBUNTU_CODENAME=xenial diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distro-1.3.0/tests/test_distro.py new/distro-1.4.0/tests/test_distro.py --- old/distro-1.3.0/tests/test_distro.py 2018-05-09 07:56:13.000000000 +0200 +++ new/distro-1.4.0/tests/test_distro.py 2019-02-04 09:25:26.000000000 +0100 @@ -211,6 +211,21 @@ } self._test_outcome(desired_outcome) + def test_fedora30_os_release(self): + # Fedora 21 and above no longer have code names but the metadata in os-release was only + # changed in a detectable way in Fedora 30+. The piece in parenthesis in the pretty_name + # field contains the VARIANT and differs depending on the variant which was installed. + desired_outcome = { + 'id': 'fedora', + 'name': 'Fedora', + 'pretty_name': 'Fedora 30 (Thirty)', + 'version': '30', + 'pretty_version': '30', + 'best_version': '30', + 'codename': '' + } + self._test_outcome(desired_outcome) + def test_kvmibm1_os_release(self): desired_outcome = { 'id': 'kvmibm', @@ -344,6 +359,19 @@ } self._test_outcome(desired_outcome) + def test_ubuntu16_os_release(self): + desired_outcome = { + 'id': 'ubuntu', + 'name': 'Ubuntu', + 'pretty_name': 'Ubuntu 16.04.1 LTS', + 'version': '16.04', + 'pretty_version': '16.04 (xenial)', + 'best_version': '16.04.1', + 'like': 'debian', + 'codename': 'xenial' + } + self._test_outcome(desired_outcome) + def test_amazon2016_os_release(self): desired_outcome = { 'id': 'amzn', @@ -697,6 +725,19 @@ } self._test_outcome(desired_outcome, 'fedora', '23') + def test_fedora30_dist_release(self): + desired_outcome = { + 'id': 'fedora', + 'name': 'Fedora', + 'pretty_name': 'Fedora 30 (Thirty)', + 'version': '30', + 'pretty_version': '30 (Thirty)', + 'best_version': '30', + 'codename': 'Thirty', + 'major_version': '30' + } + self._test_outcome(desired_outcome, 'fedora', '30') + def test_gentoo_dist_release(self): desired_outcome = { 'id': 'gentoo', @@ -765,12 +806,12 @@ desired_outcome = { 'id': 'oracle', 'name': 'Oracle Linux Server', - 'pretty_name': 'Oracle Linux Server 7.1', - 'version': '7.1', - 'pretty_version': '7.1', - 'best_version': '7.1', + 'pretty_name': 'Oracle Linux Server 7.5', + 'version': '7.5', + 'pretty_version': '7.5', + 'best_version': '7.5', 'major_version': '7', - 'minor_version': '1' + 'minor_version': '5' } self._test_outcome(desired_outcome, 'oracle', '7') @@ -836,7 +877,7 @@ # Uses redhat-release only to get information. # The id of 'rhel' can only be fixed with issue #109. desired_outcome = { - 'id': 'rhel', + 'id': 'cloudlinux', 'codename': 'Vladislav Volkov', 'name': 'CloudLinux Server', 'pretty_name': 'CloudLinux Server 5.11 (Vladislav Volkov)', @@ -851,7 +892,7 @@ def test_cloudlinux6_dist_release(self): # Same as above, only has redhat-release. desired_outcome = { - 'id': 'rhel', + 'id': 'cloudlinux', 'codename': 'Oleg Makarov', 'name': 'CloudLinux Server', 'pretty_name': 'CloudLinux Server 6.8 (Oleg Makarov)', @@ -865,7 +906,7 @@ def test_cloudlinux7_dist_release(self): desired_outcome = { - 'id': 'rhel', + 'id': 'cloudlinux', 'codename': 'Yury Malyshev', 'name': 'CloudLinux', 'pretty_name': 'CloudLinux 7.3 (Yury Malyshev)', @@ -1075,6 +1116,27 @@ } self._test_release_file_info('fedora-release', desired_info) + 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) + def test_kvmibm1_release(self): desired_outcome = { 'id': 'kvmibm', @@ -1183,19 +1245,19 @@ desired_outcome = { 'id': 'oracle', 'name': 'Oracle Linux Server', - 'pretty_name': 'Oracle Linux Server 7.1', - 'version': '7.1', - 'pretty_version': '7.1', - 'best_version': '7.1', + 'pretty_name': 'Oracle Linux Server 7.5', + 'version': '7.5', + 'pretty_version': '7.5', + 'best_version': '7.5', 'major_version': '7', - 'minor_version': '1' + 'minor_version': '5' } self._test_outcome(desired_outcome) desired_info = { 'id': 'oracle', 'name': 'Oracle Linux Server', - 'version_id': '7.1', + 'version_id': '7.5', } distro_info = self._test_release_file_info( 'oracle-release', desired_info) @@ -1362,6 +1424,26 @@ # release file: self._test_non_existing_release_file() + def test_ubuntu16_release(self): + desired_outcome = { + 'id': 'ubuntu', + 'name': 'Ubuntu', + 'pretty_name': 'Ubuntu 16.04.1 LTS', + 'version': '16.04', + 'pretty_version': '16.04 (xenial)', + 'best_version': '16.04.1', + 'like': 'debian', + 'codename': 'xenial', + 'major_version': '16', + '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() + def test_amazon2016_release(self): desired_outcome = { 'id': 'amzn', @@ -1486,7 +1568,7 @@ # Uses redhat-release only to get information. # The id of 'rhel' can only be fixed with issue #109. desired_outcome = { - 'id': 'rhel', + 'id': 'cloudlinux', 'codename': 'Vladislav Volkov', 'name': 'CloudLinux Server', 'pretty_name': 'CloudLinux Server 5.11 (Vladislav Volkov)', @@ -1501,7 +1583,7 @@ def test_cloudlinux6_release(self): # Same as above, only has redhat-release. desired_outcome = { - 'id': 'rhel', + 'id': 'cloudlinux', 'codename': 'Oleg Makarov', 'name': 'CloudLinux Server', 'pretty_name': 'CloudLinux Server 6.8 (Oleg Makarov)', @@ -1655,12 +1737,12 @@ info = _distro.info(pretty=True, best=True) _test_none(info) - def test_linux_disribution(self): + def test_linux_distribution(self): _distro = distro.LinuxDistribution(False, self.ubuntu14_os_release) i = _distro.linux_distribution() assert i == ('Ubuntu', '14.04', 'Trusty Tahr') - def test_linux_disribution_full_false(self): + def test_linux_distribution_full_false(self): _distro = distro.LinuxDistribution(False, self.ubuntu14_os_release) i = _distro.linux_distribution(full_distribution_name=False) assert i == ('ubuntu', '14.04', 'Trusty Tahr')