Skip to content

Commit

Permalink
linux_distribution for PY38
Browse files Browse the repository at this point in the history
  • Loading branch information
lindemann09 committed Apr 29, 2020
1 parent cdf3d21 commit e3619ed
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions expyriment/misc/_get_system_info.py
Expand Up @@ -72,13 +72,22 @@ def get_system_info(as_string=False):

from ..io import SerialPort, ParallelPort
from .._internals import get_settings_folder
try:
from platform import linux_distribution
except:
try:
from distro import linux_distribution #TODO: only avaiable for Linux, should it be a suggested package dependency?
except:
def linux_distribution():
return ("Linux", "?", "?")

info = {}

# Get platform specific info for Linux
if sys.platform.startswith("linux"):
os_platform = "Linux"
os_name = platform.linux_distribution()[0]
os_name = linux_distribution()[0]

details = []
if "XDG_CURRENT_DESKTOP" in os.environ:
details.append(os.environ["XDG_CURRENT_DESKTOP"])
Expand All @@ -88,7 +97,7 @@ def get_system_info(as_string=False):
os_details = ", ".join(details)
else:
os_details = ""
os_version = platform.linux_distribution()[1]
os_version = linux_distribution()[1]

try:
hardware_cpu_details = ""
Expand Down

0 comments on commit e3619ed

Please sign in to comment.