summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.rst2
-rw-r--r--glances/core/glances_config.py2
-rw-r--r--glances/core/glances_globals.py3
-rw-r--r--glances/plugins/glances_sensors.py8
-rwxr-xr-xsetup.py2
5 files changed, 12 insertions, 5 deletions
diff --git a/README.rst b/README.rst
index f1fa6f28..0362fbd2 100644
--- a/README.rst
+++ b/README.rst
@@ -34,7 +34,7 @@ Requirements
Optional dependencies:
- ``jinja2`` (for HTML output)
-- ``pysensors`` (for HW monitoring support) [Linux-only]
+- ``py3sensors`` (for HW monitoring support) [Linux-only]
- ``hddtemp`` (for HDD temperature monitoring support)
- ``batinfo`` (for battery monitoring support) [Linux-only]
diff --git a/glances/core/glances_config.py b/glances/core/glances_config.py
index 76563cdb..106bb435 100644
--- a/glances/core/glances_config.py
+++ b/glances/core/glances_config.py
@@ -57,7 +57,7 @@ class Config:
for path in self.get_paths_list():
if (os.path.isfile(path) and os.path.getsize(path) > 0):
try:
- if (sys.version_info >= (3, 2)):
+ if is_python3:
self.parser.read(path, encoding='utf-8')
else:
self.parser.read(path)
diff --git a/glances/core/glances_globals.py b/glances/core/glances_globals.py
index 74658751..734877b2 100644
--- a/glances/core/glances_globals.py
+++ b/glances/core/glances_globals.py
@@ -52,6 +52,9 @@ work_path = os.path.realpath(os.path.dirname(__file__))
appname_path = os.path.split(sys.argv[0])[0]
sys_prefix = os.path.realpath(os.path.dirname(appname_path))
+# Is this Python 3?
+is_python3 = sys.version_info >= (3, 2)
+
# Operating system flag
# Note: Somes libs depends of OS
is_BSD = sys.platform.find('bsd') != -1
diff --git a/glances/plugins/glances_sensors.py b/glances/plugins/glances_sensors.py
index c11f61ee..5f5a24ee 100644
--- a/glances/plugins/glances_sensors.py
+++ b/glances/plugins/glances_sensors.py
@@ -26,6 +26,7 @@ except:
pass
# Import Glances lib
+from glances.core.glances_globals import is_python3
from glances_hddtemp import Plugin as HddTempPlugin
from glances_plugin import GlancesPlugin
# from glances.core.glances_timer import getTimeSinceLastUpdate
@@ -61,7 +62,7 @@ class glancesGrabSensors:
for chip in sensors.iter_detected_chips():
for feature in chip:
sensors_current = {}
- if feature.name.startswith('temp'):
+ if feature.name.startswith(b'temp'):
sensors_current['label'] = feature.label[:20]
sensors_current['value'] = int(feature.get_value())
self.sensors_list.append(sensors_current)
@@ -117,7 +118,10 @@ class Plugin(GlancesPlugin):
# Header
msg = "{0:8}".format(_("SENSORS"))
ret.append(self.curse_add_line(msg, "TITLE"))
- msg = "{0:>16}".format(_("°C"))
+ if is_python3:
+ msg = "{0:>15}".format(_("°C"))
+ else:
+ msg = "{0:>16}".format(_("°C"))
ret.append(self.curse_add_line(msg))
# Sensors list (sorted by name): Sensors
sensor_list = sorted(self.stats, key=lambda sensors: sensors['label'])
diff --git a/setup.py b/setup.py
index 3fd8f47b..30100cd9 100755
--- a/setup.py
+++ b/setup.py
@@ -45,7 +45,7 @@ setup(
install_requires=requires,
extras_require={
'HTML': ['jinja2'],
- 'SENSORS': ['pysensors'],
+ 'SENSORS': ['py3sensors'],
'BATINFO': ['batinfo']
},
packages=['glances'],