From 9a5591e4f9c52492173d4afb061f89e1d7bbd944 Mon Sep 17 00:00:00 2001 From: nir0s Date: Sun, 21 Jan 2018 09:54:57 +0200 Subject: [PATCH 01/11] Update some docs with regard to BSD support --- README.md | 10 ++++++---- docs/index.rst | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f810c963..2db989d8 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,15 @@ Distro - an OS platform information API [![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` (for: Linux Distribution) provides information about the -Linux distribution it runs on, such as a reliable machine-readable ID, or +`distro` provides information about the +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. +Distro currently supports Linux and BSD based systems but [Windows and OS X support](https://github.com/nir0s/distro/issues/177) is also planned. ## Installation @@ -81,18 +82,19 @@ 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 Linux distribution based on new standards and old methods, +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 Linux distribution that provides one or more of the data sources +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). diff --git a/docs/index.rst b/docs/index.rst index 72d0fe4d..0584dc68 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -54,7 +54,7 @@ namely from these data sources: * The `distro release file`_, if present. -* The uname command output, if present. +* The `uname command output`_, if present. Access to the information @@ -114,7 +114,7 @@ distribution: A user-defined instance of the :class:`distro.LinuxDistribution` class allows specifying the path names of the os-release file and distro release file and whether the lsb_release command should be used or not. That is useful for - example when the Linux distribution information from a chrooted environment + example when the distribution information from a chrooted environment is to be retrieved, or when a distro has multiple distro release files and the default algorithm uses the wrong one. @@ -387,7 +387,7 @@ and where the first line within the file has the expected format. The algorithm to sort the files alphabetically is far from perfect, but the distro release file has the least priority as a data source, and it is expected -that Linux distributions provide one of the other data sources. +that distributions provide one of the other data sources. The distro release file is expected to be encoded in UTF-8. From 85eabb5ad3d0330e8db932ea2288778f1c28d96d Mon Sep 17 00:00:00 2001 From: nir0s Date: Wed, 18 Apr 2018 16:11:34 +0300 Subject: [PATCH 02/11] Add contributors file --- CONTRIBUTORS.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 CONTRIBUTORS.md diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 00000000..922f6533 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,13 @@ +Thanks! + +* https://github.com/andy-maier +* https://github.com/SethMichaelLarson +* https://github.com/asottile +* https://github.com/MartijnBraam +* https://github.com/funkyfuture +* https://github.com/adamjstewart +* https://github.com/xavfernandez +* https://github.com/xsuchy +* https://github.com/marcoceppi +* https://github.com/tgamblin +* https://github.com/sebix From b1edd45cdb74085ef7e1d6d6058da751760bb546 Mon Sep 17 00:00:00 2001 From: nir0s Date: Wed, 18 Apr 2018 16:10:17 +0300 Subject: [PATCH 03/11] Redo changelog --- CHANGELOG.md | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++ CHANGES | 78 -------------------------------- 2 files changed, 122 insertions(+), 78 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 CHANGES diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..79f52ab0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,122 @@ +## Unreleased + +ENHANCEMENTS: +* Update docs with regards to #207 [[#209](#209)] +* Added support for OpenBSD, FreeBSD, and NetBSD [[#207](#207)] + + +## 1.2.0 (2017.12.24) + +BACKWARD COMPATIBILITY: +* Don't raise ImportError on non-linux platforms [[#202](#202)] + +ENHANCEMENTS: +* Lazily load the LinuxDistribution data [[#201](#201)] + +BUG FIXES: +* Stdout of shell should be decoded with sys.getfilesystemencoding() [[#203](#203)] + +TESTS: +* Explicitly set Python versions on Travis for flake [[#204](#204)] + + +## 1.1.0 (2017.11.28) + +BACKWARD COMPATIBILITY: +* Drop python3.3 support [[#199](#199)] +* Remove Official Python26 support [[#195](#195)] + +TESTS: +* Add MandrivaLinux test case [[#181](#181)] +* Add test cases for CloudLinux 5, 6, and 7 [[#180](#180)] + +RELEASE: +* Modify MANIFEST to include resources for tests and docs in source tarballs [[97c91a1](97c91a1)] + +## 1.0.4 (2017.04.01) + +BUG FIXES: +* Guess common *-release files if /etc not readable [[#175](#175)] + +## 1.0.3 (2017.03.19) + +ENHANCEMENTS: +* Show keys for empty values when running distro from the CLI [[#160](#160)] +* Add manual mapping for `redhatenterpriseserver` (previously only redhatenterpriseworkstation was mapped) [[#148](#148)] +* Race condition in `_parse_distro_release_file` [[#163](#163)] + +TESTS: +* Add RHEL5 test case [[#165](#165)] +* Add OpenELEC test case [[#166](#166)] +* Replace nose with pytest [[#158](#158)] + +RELEASE: +* Update classifiers +* Update supported Python versions (with py36) + +## 1.0.2 (2017.01.12) + +TESTS: +* Test on py33, py36 and py3 based flake8 + +RELEASE: +* Add MANIFEST file (which also includes the LICENSE as part of Issue [[#139](#139)]) +* Default to releasing using Twine [[#121](#121)] +* Add setup.cfg file [[#145](#145)] +* Update license in setup.py + +## 1.0.1 (2016-11-03) + +ENHANCEMENTS: +* Prettify distro -j's output and add more elaborate docs [[#147](#147)] +* Decode output of `lsb_release` as utf-8 [[#144](#144)] +* Logger now uses `message %s, string` form to not-evaulate log messages if unnecessary [[#145](#145)] + +TESTS: +* Increase code-coverage [[#146](#146)] +* Fix landscape code-quality warnings [[#145](#145)] + +RELEASE: +* Add CONTRIBUTING.md + +## 1.0.0 (2016-09-25) + +BACKWARD COMPATIBILITY: +* raise exception when importing on non-supported platforms [[#129](#129)] + +ENHANCEMENTS: +* Use `bytes` invariantly [[#135](#135)] +* Some minor code adjustments plus a CLI [[#134](#134)] +* Emit stderr if `lsb_release` fails + +BUG FIXES: +* Fix some encoding related issues + +TESTS: +* Add many test cases (e.g. Raspbian 8, CoreOS, Amazon Linux, Scientific Linux, Gentoo, Manjaro) +* Completely redo the testing framework to make it easier to add tests +* Test on pypy + +RELEASE: +* Remove six as a dependency + +## 0.6.0 (2016-04-21) + +This is the first release of `distro`. +All previous work was done on `ld` and therefore unmentioned here. See the release log in GitHub if you want the entire log. + +BACKWARD COMPATIBILITY: +* No longer a package. constants.py has been removed and distro is now a single module + +ENHANCEMENTS: +* distro.info() now receives best and pretty flags +* Removed get_ prefix from get_*_release_attr functions +* Codename is now passed in distro.info() + +TESTS: +* Added Linux Mint test case +* Now testing on Python 3.4 + +DOCS: +* Documentation fixes + diff --git a/CHANGES b/CHANGES deleted file mode 100644 index 39c463b1..00000000 --- a/CHANGES +++ /dev/null @@ -1,78 +0,0 @@ -**Unreleased** - -* Added support for OpenBSD, FreeBSD, and NetBSD - -**1.2.0 (2017.12.24)** - -* Lazily load parsers to speed up import time. -* Don't raise import error on non-linux os. -* Decode stdout of shell sys.getfilesystemencoding(). -* Explicitly set Python versions for flake8 tests. - - -**1.1.0 (2017.11.28)** - -Note: This version removes official support for Python 2.6. If you need a version that is tested on Python 2.6, please use `distro<=1.0.4`. - -In addition: - -* Add tests for MandrivaLinux, CloudLinux 5,6,7 -* Modify MANIFEST to include resources for tests and docs in source tarballs (https://github.com/nir0s/distro/pull/189/files#diff-97c91a104c431d0c365565d3ac03ac13) - - -**1.0.4 (2017.04.01)** - -* Fix not being able to read `/etc/` and yet able to read release files inside it. - -**1.0.3 (2017.03.19)** - -* Add manual mapping for `redhatenterpriseserver` (previously only redhatenterpriseworkstation was mapped) -* Return empty information when failing to read a seemingly version related file due to IO or OS errors. -* When using the CLI without providing the -j flag, printout keys even if their values are empty. -* Replace nose with pytest -* Add RHEL5 test case -* Add OpenELEC test case -* Update supported Python versions (with py36) -* Update classifiers - -**1.0.2 (2017.01.12)** - -* Add MANIFEST file (which also includes the LICENSE as part of Issue #139) -* Default to releasing using Twine (as per Issue #121) -* Update license in setup.py -* Test on py33, py36 and py3 based flake8 -* Add setup.cfg file - -**1.0.1 (2016-11-03)** - -* Prettify output when running `distro -j` -* Decode output of `lsb_release` as utf-8 -* Mend code coverage -* Logger now uses `message %s, string` form to not-evaulate log messages if unnecessary -* Add landscape.io code-quality monitoring -* Add CONTRIBUTING.md - -**1.0.0 (2016-09-25)** - -* Add a CLI and a `distro` entry point. For Python 2.6, argparse will be installed -* Add many test cases (e.g. Raspbian 8, CoreOS, Amazon Linux, Scientific Linux, Gentoo, Manjaro) -* Make distro non-importable on non-compatible platforms (e.g. Windows and tested via AppVeyor) -* Completely redo the testing framework to make it easier to add tests -* Remove six as a dependency -* Emit stderr if `lsb_release` fails -* Fix some encoding related issues -* We now use `bytes` invariantly -* Test on pypy - -**0.6.0 (2016-04-21)** - -* Introduces a new name (`distro`) -* No longer a package. constants.py has been removed and distro is now a single module -* Documentation fixes -* distro.info() now receives best and pretty flags -* Added Linux Mint test case -* Removed get_ prefix from get_*_release_attr functions -* Now testing on Python 3.4 -* Codename is now passed in distro.info() - -All previous work was done on `ld` and therefore unmentioned here. See the release log in GitHub if you want the entire log. From dd6c1e68abf2de0541ad8b408e6f289acc178e66 Mon Sep 17 00:00:00 2001 From: nir0s Date: Wed, 9 May 2018 08:37:21 +0300 Subject: [PATCH 04/11] Add Ansible reference implementation and fix arch-linux link --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2db989d8..c7852434 100644 --- a/README.md +++ b/README.md @@ -122,11 +122,12 @@ 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 ## Package manager distributions * https://admin.fedoraproject.org/pkgdb/package/rpms/python-distro/ -* https://aur.archlinux.org/packages/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 From 822f49c79691fd04dc3e97c4445ede503a9a76fa Mon Sep 17 00:00:00 2001 From: nir0s Date: Wed, 9 May 2018 08:46:05 +0300 Subject: [PATCH 05/11] Add test for Kali Linux Rolling --- tests/resources/distros/kali/etc/os-release | 10 ++++++++++ tests/test_distro.py | 22 ++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 tests/resources/distros/kali/etc/os-release diff --git a/tests/resources/distros/kali/etc/os-release b/tests/resources/distros/kali/etc/os-release new file mode 100644 index 00000000..4436a0d3 --- /dev/null +++ b/tests/resources/distros/kali/etc/os-release @@ -0,0 +1,10 @@ +PRETTY_NAME="Kali GNU/Linux Rolling" +NAME="Kali GNU/Linux" +ID=kali +VERSION="2017.1" +VERSION_ID="2017.1" +ID_LIKE=debian +ANSI_COLOR="1;31" +HOME_URL="http://www.kali.org/" +SUPPORT_URL="http://forums.kali.org/" +BUG_REPORT_URL="http://bugs.kali.org/" diff --git a/tests/test_distro.py b/tests/test_distro.py index 0bfdbd2a..f5ac2b2b 100644 --- a/tests/test_distro.py +++ b/tests/test_distro.py @@ -139,6 +139,18 @@ def test_arch_os_release(self): } self._test_outcome(desired_outcome) + def test_kali_os_release(self): + desired_outcome = { + 'id': 'kali', + 'name': 'Kali GNU/Linux', + 'pretty_name': 'Kali GNU/Linux Rolling', + 'version': '2017.1', + 'pretty_version': '2017.1', + 'best_version': '2017.1', + 'like': 'debian' + } + self._test_outcome(desired_outcome) + def test_centos7_os_release(self): desired_outcome = { 'id': 'centos', @@ -584,12 +596,12 @@ def test_unknowndistro_release(self): 'minor_version': '0' } self._test_outcome(desired_outcome) - + def test_bad_uname(self): self._setup_for_distro(os.path.join(TESTDISTROS, 'distro', 'baduname')) self.distro = distro.LinuxDistribution() - + assert self.distro.uname_attr('id') == '' assert self.distro.uname_attr('name') == '' assert self.distro.uname_attr('release') == '' @@ -1530,7 +1542,7 @@ def setup_method(self, test_method): self._old_listdir = os.listdir os.listdir = _bad_os_listdir super(TestOverallWithEtcNotReadable, self).setup_method(test_method) - + def teardown_method(self, test_method): super(TestOverallWithEtcNotReadable, self).teardown_method(test_method) if os.listdir is _bad_os_listdir: @@ -1944,11 +1956,11 @@ def _test_consistency(function, kwargs=None): ] for key in distro_release_keys: _test_consistency('distro_release_attr', {'attribute': key}) - + uname_keys = [ 'id', 'name', - 'release' + 'release' ] for key in uname_keys: _test_consistency('uname_attr', {'attribute': key}) From ab38aa059fbcd186f9a9179c757b8a096464e597 Mon Sep 17 00:00:00 2001 From: nir0s Date: Wed, 9 May 2018 08:55:59 +0300 Subject: [PATCH 06/11] Fix CHANGELOG.md issue links --- CHANGELOG.md | 61 ++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f52ab0..e536d9d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,34 +1,39 @@ ## Unreleased ENHANCEMENTS: -* Update docs with regards to #207 [[#209](#209)] -* Added support for OpenBSD, FreeBSD, and NetBSD [[#207](#207)] +* Added support for OpenBSD, FreeBSD, and NetBSD [[#207](https://github.com/nir0s/distro/issues/207)] +TESTS: +* Add test for Kali Linux Rolling [[#214](https://github.com/nir0s/distro/issues/214)] + +DOCS: +* Update docs with regards to #207 [[#209](https://github.com/nir0s/distro/issues/209)] +* Add Ansible reference implementation and fix arch-linux link [[#213](https://github.com/nir0s/distro/issues/213)] ## 1.2.0 (2017.12.24) BACKWARD COMPATIBILITY: -* Don't raise ImportError on non-linux platforms [[#202](#202)] +* Don't raise ImportError on non-linux platforms [[#202](https://github.com/nir0s/distro/issues/202)] ENHANCEMENTS: -* Lazily load the LinuxDistribution data [[#201](#201)] +* Lazily load the LinuxDistribution data [[#201](https://github.com/nir0s/distro/issues/201)] BUG FIXES: -* Stdout of shell should be decoded with sys.getfilesystemencoding() [[#203](#203)] +* Stdout of shell should be decoded with sys.getfilesystemencoding() [[#203](https://github.com/nir0s/distro/issues/203)] TESTS: -* Explicitly set Python versions on Travis for flake [[#204](#204)] +* Explicitly set Python versions on Travis for flake [[#204](https://github.com/nir0s/distro/issues/204)] ## 1.1.0 (2017.11.28) BACKWARD COMPATIBILITY: -* Drop python3.3 support [[#199](#199)] -* Remove Official Python26 support [[#195](#195)] +* Drop python3.3 support [[#199](https://github.com/nir0s/distro/issues/199)] +* Remove Official Python26 support [[#195](https://github.com/nir0s/distro/issues/195)] TESTS: -* Add MandrivaLinux test case [[#181](#181)] -* Add test cases for CloudLinux 5, 6, and 7 [[#180](#180)] +* Add MandrivaLinux test case [[#181](https://github.com/nir0s/distro/issues/181)] +* Add test cases for CloudLinux 5, 6, and 7 [[#180](https://github.com/nir0s/distro/issues/180)] RELEASE: * Modify MANIFEST to include resources for tests and docs in source tarballs [[97c91a1](97c91a1)] @@ -36,19 +41,19 @@ RELEASE: ## 1.0.4 (2017.04.01) BUG FIXES: -* Guess common *-release files if /etc not readable [[#175](#175)] +* Guess common *-release files if /etc not readable [[#175](https://github.com/nir0s/distro/issues/175)] ## 1.0.3 (2017.03.19) ENHANCEMENTS: -* Show keys for empty values when running distro from the CLI [[#160](#160)] -* Add manual mapping for `redhatenterpriseserver` (previously only redhatenterpriseworkstation was mapped) [[#148](#148)] -* Race condition in `_parse_distro_release_file` [[#163](#163)] +* Show keys for empty values when running distro from the CLI [[#160](https://github.com/nir0s/distro/issues/160)] +* Add manual mapping for `redhatenterpriseserver` (previously only redhatenterpriseworkstation was mapped) [[#148](https://github.com/nir0s/distro/issues/148)] +* Race condition in `_parse_distro_release_file` [[#163](https://github.com/nir0s/distro/issues/163)] TESTS: -* Add RHEL5 test case [[#165](#165)] -* Add OpenELEC test case [[#166](#166)] -* Replace nose with pytest [[#158](#158)] +* Add RHEL5 test case [[#165](https://github.com/nir0s/distro/issues/165)] +* Add OpenELEC test case [[#166](https://github.com/nir0s/distro/issues/166)] +* Replace nose with pytest [[#158](https://github.com/nir0s/distro/issues/158)] RELEASE: * Update classifiers @@ -60,21 +65,21 @@ TESTS: * Test on py33, py36 and py3 based flake8 RELEASE: -* Add MANIFEST file (which also includes the LICENSE as part of Issue [[#139](#139)]) -* Default to releasing using Twine [[#121](#121)] -* Add setup.cfg file [[#145](#145)] +* Add MANIFEST file (which also includes the LICENSE as part of Issue [[#139](https://github.com/nir0s/distro/issues/139)]) +* Default to releasing using Twine [[#121](https://github.com/nir0s/distro/issues/121)] +* Add setup.cfg file [[#145](https://github.com/nir0s/distro/issues/145)] * Update license in setup.py ## 1.0.1 (2016-11-03) ENHANCEMENTS: -* Prettify distro -j's output and add more elaborate docs [[#147](#147)] -* Decode output of `lsb_release` as utf-8 [[#144](#144)] -* Logger now uses `message %s, string` form to not-evaulate log messages if unnecessary [[#145](#145)] +* Prettify distro -j's output and add more elaborate docs [[#147](https://github.com/nir0s/distro/issues/147)] +* Decode output of `lsb_release` as utf-8 [[#144](https://github.com/nir0s/distro/issues/144)] +* Logger now uses `message %s, string` form to not-evaulate log messages if unnecessary [[#145](https://github.com/nir0s/distro/issues/145)] TESTS: -* Increase code-coverage [[#146](#146)] -* Fix landscape code-quality warnings [[#145](#145)] +* Increase code-coverage [[#146](https://github.com/nir0s/distro/issues/146)] +* Fix landscape code-quality warnings [[#145](https://github.com/nir0s/distro/issues/145)] RELEASE: * Add CONTRIBUTING.md @@ -82,11 +87,11 @@ RELEASE: ## 1.0.0 (2016-09-25) BACKWARD COMPATIBILITY: -* raise exception when importing on non-supported platforms [[#129](#129)] +* raise exception when importing on non-supported platforms [[#129](https://github.com/nir0s/distro/issues/129)] ENHANCEMENTS: -* Use `bytes` invariantly [[#135](#135)] -* Some minor code adjustments plus a CLI [[#134](#134)] +* Use `bytes` invariantly [[#135](https://github.com/nir0s/distro/issues/135)] +* Some minor code adjustments plus a CLI [[#134](https://github.com/nir0s/distro/issues/134)] * Emit stderr if `lsb_release` fails BUG FIXES: From 9c7d9e637ab6f101d19165cb708aa331fae67b3f Mon Sep 17 00:00:00 2001 From: nir0s Date: Wed, 9 May 2018 09:47:11 +0300 Subject: [PATCH 07/11] Add facter reference implementation --- CHANGELOG.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e536d9d5..667c1af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ TESTS: DOCS: * Update docs with regards to #207 [[#209](https://github.com/nir0s/distro/issues/209)] * Add Ansible reference implementation and fix arch-linux link [[#213](https://github.com/nir0s/distro/issues/213)] +* Add facter reference implementation [[#213](https://github.com/nir0s/distro/issues/213)] ## 1.2.0 (2017.12.24) diff --git a/README.md b/README.md index c7852434..49755976 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ 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 From d8772664a7f1514774d00fdcf315e8c17c8b924d Mon Sep 17 00:00:00 2001 From: nir0s Date: Wed, 9 May 2018 10:44:23 +0300 Subject: [PATCH 08/11] Release v1.3.0 --- CHANGELOG.md | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 667c1af6..beb46b80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Unreleased +## 1.3.0 (2018.05.09) ENHANCEMENTS: * Added support for OpenBSD, FreeBSD, and NetBSD [[#207](https://github.com/nir0s/distro/issues/207)] diff --git a/setup.py b/setup.py index d39ec926..cfe20843 100644 --- a/setup.py +++ b/setup.py @@ -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.2.0" +package_version = "1.3.0" here = os.path.abspath(os.path.dirname(__file__)) From 47c86e6ef9efdde2687e09f78a1b7d17dc90a8de Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 16 May 2018 19:06:00 -0400 Subject: [PATCH 09/11] Use Markdown for long description in setup.py You'll need setuptools 38.6.0+ and twine 1.11+ to release/upload this; see Dustin Ingram's blog: https://dustingram.com/articles/2018/03/16/markdown-descriptions-on-pypi --- README.rst | 4 ---- setup.py | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 README.rst diff --git a/README.rst b/README.rst deleted file mode 100644 index 7aac2660..00000000 --- a/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -Distro - an OS platform information API -======================================= - -See `Official GitHub repo `_. diff --git a/setup.py b/setup.py index cfe20843..92c957a0 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,8 @@ def read(*parts): 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': [ From 500d206568e7f7ba2d6d391fdc8e4763a3520973 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 16 May 2018 17:21:29 -0400 Subject: [PATCH 10/11] Distro is the recommended replacement for platform.linux_distribution The distro package is now recommended in Python documentation as a replacement for `platform.linux_distribution`. See: * https://docs.python.org/3.7/library/platform.html#platform.linux_distribution * https://github.com/python/cpython/pull/6669 Also, `platform.linux_distribution` is removed from Python 3.8 (which is not released yet). See: * https://docs.python.org/3.8/library/platform.html * https://github.com/python/cpython/pull/6871 Reflect this in `distro`'s README and docstring. --- README.md | 12 +++++++----- distro.py | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 49755976..7a9489d8 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,11 @@ Distro - an OS platform information API 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. @@ -74,9 +76,9 @@ 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.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. diff --git a/distro.py b/distro.py index aa4defc3..80a90367 100755 --- a/distro.py +++ b/distro.py @@ -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 `_ for more information. From 9faf9899160dbace478ec7d33e929e2f9083d573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sat, 1 Sep 2018 10:26:07 +0200 Subject: [PATCH 11/11] Update Fedora package link The old one uses a now removed system, the link 404s --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a9489d8..8d80f04c 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ formats can be found here: ## 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