Skip to content

Commit

Permalink
Merge branch 'issue2776' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed May 16, 2024
2 parents 6acd0da + d095e4a commit 05bc144
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions glances/plugins/sensors/sensor/glances_batpercent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@

from glances.logger import logger
from glances.plugins.plugin.model import GlancesPluginModel
from glances.globals import LINUX

# Batinfo library (optional; Linux-only)
batinfo_tag = True
try:
import batinfo
except ImportError:
logger.debug("batinfo library not found. Fallback to psutil.")
if LINUX:
batinfo_tag = True
try:
import batinfo
except ImportError:
logger.debug("batinfo library not found. Fallback to psutil.")
batinfo_tag = False
else:
batinfo_tag = False

# Availability:
# Linux, Windows, FreeBSD (psutil>=5.1.0)
# macOS (psutil>=5.4.2)
# PsUtil Sensors_battery available on Linux, Windows, FreeBSD, macOS
psutil_tag = True
try:
psutil.sensors_battery()
Expand Down

0 comments on commit 05bc144

Please sign in to comment.