Use code from the distro package to improve linux distro detection. (#1629)

* Use code from the `distro` package to improve linux distro detection.

Various issues [1] [2] with the platform.linux_distribution function led
to the function being deprecated in python 3.4. The pipi package distro
[3] contains compatible improved code that better tracks current methods
for identifying linux distributions (see, for example, [4],[5]).

[1]: https://bugs.python.org/issue20454
[2]: http://bugs.python.org/issue1322
[3]: https://pypi.python.org/pypi/distro
[4]: https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/lsbrelease.html
[5]: https://www.freedesktop.org/software/systemd/man/os-release.html

* fix (potential) unicode problems
This commit is contained in:
Jeffrey Salmond 2016-11-04 23:38:44 +00:00 committed by Todd Gamblin
parent c3d9dda0e5
commit 9cd83a4efb
2 changed files with 1051 additions and 2 deletions

1048
lib/spack/external/distro.py vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
import re
import platform as py_platform
from external.distro import linux_distribution
from spack.architecture import OperatingSystem
@ -12,8 +12,9 @@ class LinuxDistro(OperatingSystem):
"""
def __init__(self):
distname, version, _ = py_platform.linux_distribution(
distname, version, _ = linux_distribution(
full_distribution_name=False)
distname, version = str(distname), str(version)
# Grabs major version from tuple on redhat; on other platforms
# grab the first legal identifier in the version field. On