lbry-sdk/lbry/extras/system_info.py

30 lines
900 B
Python
Raw Normal View History

import platform
2017-04-26 14:18:41 -04:00
import os
2018-11-09 14:02:03 -05:00
import logging.handlers
2020-01-23 08:40:24 -05:00
from lbry import build_info, __version__ as lbrynet_version
log = logging.getLogger(__name__)
2018-11-07 18:35:32 -05:00
def get_platform() -> dict:
2019-05-17 14:00:25 -04:00
os_system = platform.system()
if os.environ and 'ANDROID_ARGUMENT' in os.environ:
os_system = 'android'
2020-01-03 01:48:36 -05:00
d = {
"processor": platform.processor(),
"python_version": platform.python_version(),
"platform": platform.platform(),
"os_release": platform.release(),
2019-05-17 14:00:25 -04:00
"os_system": os_system,
"lbrynet_version": lbrynet_version,
"version": lbrynet_version,
2020-01-23 08:40:24 -05:00
"build": build_info.BUILD, # CI server sets this during build step
}
2020-01-03 01:48:36 -05:00
if d["os_system"] == "Linux":
2019-09-24 12:53:23 -03:00
import distro # pylint: disable=import-outside-toplevel
2020-01-03 01:48:36 -05:00
d["distro"] = distro.info()
d["desktop"] = os.environ.get('XDG_CURRENT_DESKTOP', 'Unknown')
2020-01-03 01:48:36 -05:00
return d