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