2016-11-10 15:49:51 -05:00
|
|
|
import platform
|
2017-04-26 14:18:41 -04:00
|
|
|
import os
|
2018-11-09 14:02:03 -05:00
|
|
|
import logging.handlers
|
2016-11-10 15:49:51 -05:00
|
|
|
|
2020-01-23 08:40:24 -05:00
|
|
|
from lbry import build_info, __version__ as lbrynet_version
|
2018-09-19 13:42:12 -03:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
2016-11-10 15:49:51 -05:00
|
|
|
|
|
|
|
|
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 = {
|
2016-11-10 15:49:51 -05:00
|
|
|
"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,
|
2018-11-09 13:06:02 -05:00
|
|
|
"lbrynet_version": lbrynet_version,
|
2019-12-31 14:52:57 -05:00
|
|
|
"version": lbrynet_version,
|
2020-01-23 08:40:24 -05:00
|
|
|
"build": build_info.BUILD, # CI server sets this during build step
|
2016-11-10 15:49:51 -05:00
|
|
|
}
|
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')
|
2016-11-10 15:49:51 -05:00
|
|
|
|
2020-01-03 01:48:36 -05:00
|
|
|
return d
|