mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-29 04:04:03 +03:00
Revert "Deprecated platform method in Python 3.7 #945"
This reverts commit 4877be45ea
.
This commit is contained in:
parent
fc9580bc41
commit
85fa23ab71
1
NEWS
1
NEWS
@ -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:
|
||||
|
@ -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()
|
||||
|
@ -1,2 +1 @@
|
||||
psutil==4.4.0
|
||||
distro==1.0.0
|
||||
|
Loading…
Reference in New Issue
Block a user