Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
## 1.3.0 (2018.05.09)

ENHANCEMENTS:
* 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)]
* Add facter reference implementation [[#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](https://github.com/nir0s/distro/issues/202)]

ENHANCEMENTS:
* 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](https://github.com/nir0s/distro/issues/203)]

TESTS:
* 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](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](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)]

## 1.0.4 (2017.04.01)

BUG FIXES:
* 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](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](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
* 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](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](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](https://github.com/nir0s/distro/issues/146)]
* Fix landscape code-quality warnings [[#145](https://github.com/nir0s/distro/issues/145)]

RELEASE:
* Add CONTRIBUTING.md

## 1.0.0 (2016-09-25)

BACKWARD COMPATIBILITY:
* raise exception when importing on non-supported platforms [[#129](https://github.com/nir0s/distro/issues/129)]

ENHANCEMENTS:
* 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:
* 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

78 changes: 0 additions & 78 deletions CHANGES

This file was deleted.

13 changes: 13 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -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
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ 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.
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.

## Installation

Expand Down Expand Up @@ -73,26 +76,27 @@ 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.

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).
Expand Down Expand Up @@ -120,11 +124,13 @@ 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://admin.fedoraproject.org/pkgdb/package/rpms/python-distro/
* https://aur.archlinux.org/packages/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
* https://packages.gentoo.org/packages/dev-python/distro
Expand Down
4 changes: 0 additions & 4 deletions README.rst

This file was deleted.

8 changes: 4 additions & 4 deletions distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))

Expand All @@ -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': [
Expand Down
10 changes: 10 additions & 0 deletions tests/resources/distros/kali/etc/os-release
Original file line number Diff line number Diff line change
@@ -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/"
Loading