Bug ID 997614
Summary python's platform.linux_distribution() doesn't understand /etc/os-release
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware Other
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Development
Assignee bnc-team-screening@forge.provo.novell.com
Reporter tserong@suse.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

> cat /etc/SuSE-release 
cat: /etc/SuSE-release: No such file or directory

> cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20160831"
ID=opensuse
ID_LIKE="suse"
VERSION_ID="20160831"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20160831"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

> python -c 'import platform ; print platform.linux_distribution()'
('', '', '')

That's odd.  Python doesn't know what distro we're running on.

But, on an earlier Tumbleweed release:

> cat /etc/SuSE-release 
openSUSE 20160701 (x86_64)
VERSION = 20160701
CODENAME = Tumbleweed
# /etc/SuSE-release is deprecated and will be removed in the future, use
/etc/os-release instead

> cat /etc/os-release 
NAME=openSUSE
VERSION="Tumbleweed"
VERSION_ID="20160701"
PRETTY_NAME="openSUSE Tumbleweed (20160701) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:20160701"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
ID_LIKE="suse"

> python -c 'import platform ; print platform.linux_distribution()'
('openSUSE ', '20160701', 'x86_64')

Turns out the file matching in /usr/lib64/python2.7/platform.py (line 323+) is
looking for files named /(\w+)[-_](release|version)/, so it picks up
"os-release", and decides _distname is "os", which *isn't* in _supported_dists
(_supported_dists includes "SuSE", "debian", "fedora", etc. but no generic
"os").  So, as we apparently no longer ship SuSE-release, and there's no other
release-like files to parse, and we end up with platform.linux_distribution()
having no idea what's going on.


You are receiving this mail because: