Add virtual_env check to sysinfo

This commit is contained in:
torzdf
2018-12-10 11:09:54 +00:00
parent 93ab46363b
commit b0ffd8a08c
+10 -3
View File
@@ -38,19 +38,25 @@ class SysInfo():
@property
def is_linux(self):
""" Boolean for whether in a conda environment """
""" Boolean for whether system is Linux """
return self.system.lower() == "linux"
@property
def is_macos(self):
""" Boolean for whether in a conda environment """
""" Boolean for whether system is macOS """
return self.system.lower() == "darwin"
@property
def is_windows(self):
""" Boolean for whether in a conda environment """
""" Boolean for whether system is Windows """
return self.system.lower() == "windows"
@property
def is_virtual_env(self):
""" Boolean for whether running in a virtual environment """
return hasattr(sys, "real_prefix") or (
hasattr(sys, "base_prefix") and sys.base_prefix != sys.prefix)
@property
def ram(self):
""" Return RAM stats """
@@ -241,6 +247,7 @@ class SysInfo():
"py_implementation": self.py_implementation,
"py_version": self.py_version,
"py_command": self.fs_command,
"py_virtual_env": self.is_virtual_env,
"sys_cores": self.cpu_count,
"sys_processor": self.processor,
"sys_ram": self.format_ram(),