diff options
author | Alessio Sergi <al3hex@gmail.com> | 2016-10-31 19:10:12 +0100 |
---|---|---|
committer | Alessio Sergi <al3hex@gmail.com> | 2016-11-02 10:12:03 +0100 |
commit | 85fa23ab713813a064c1202eb7e5f984c8d42149 (patch) | |
tree | 73414e4c07e98e71a1ed676f8a03ba20a34283b6 | |
parent | fc9580bc41936c889585bb58ca3b37d886a2534a (diff) |
Revert "Deprecated platform method in Python 3.7 #945"
This reverts commit 4877be45ea60e9bfa5b7820bf6f61e3d53ed0fd9.
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | glances/plugins/glances_system.py | 25 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rwxr-xr-x | setup.py | 2 |
4 files changed, 6 insertions, 23 deletions
@@ -21,7 +21,6 @@ Enhancements and news features: * Configure server cached time from the command line --cached-time (issue #901) * Make the log logger configurable (issue #900) * System uptime in export (issue #890) - * Deprecated platform method in Python 3.7 (issue #945) * Refactor the --disable-* options (issue #948) Bugs corrected: diff --git a/glances/plugins/glances_system.py b/glances/plugins/glances_system.py index a2eec6ab..58c60310 100644 --- a/glances/plugins/glances_system.py +++ b/glances/plugins/glances_system.py @@ -23,14 +23,7 @@ import os import platform import re from io import open -try: - import distro -except ImportError: - distro_tag = False -else: - distro_tag = True - -from glances.logger import logger + from glances.compat import iteritems from glances.plugins.glances_plugin import GlancesPlugin @@ -120,19 +113,11 @@ class Plugin(GlancesPlugin): self.stats['hostname'] = platform.node() self.stats['platform'] = platform.architecture()[0] if self.stats['os_name'] == "Linux": - if distro_tag: - # Use the distro external lib - # Why ? - # Because platform.linux_distribution is predicated in Python 3.7 - linux_distro = distro.linux_distribution() - self.stats['linux_distro'] = ' '.join(linux_distro[:2]) + linux_distro = platform.linux_distribution() + if linux_distro[0] == '': + self.stats['linux_distro'] = _linux_os_release() else: - try: - # For Python < 3.7 - linux_distro = platform.linux_distribution() - self.stats['linux_distro'] = ' '.join(linux_distro[:2]) - except AttributeError: - self.stats['linux_distro'] = _linux_os_release() + self.stats['linux_distro'] = ' '.join(linux_distro[:2]) self.stats['os_version'] = platform.release() elif self.stats['os_name'].endswith('BSD'): self.stats['os_version'] = platform.release() diff --git a/requirements.txt b/requirements.txt index 55b276a6..1bc0bdc9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ psutil==4.4.0 -distro==1.0.0 @@ -33,7 +33,7 @@ def get_data_files(): def get_requires(): - requires = ['psutil>=2.0.0', 'distro>=1.0.0'] + requires = ['psutil>=2.0.0'] return requires |