From 88095af1cdfce9bebb1f54ae4bc00a95083806f0 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Fri, 9 Nov 2018 13:06:02 -0500 Subject: [PATCH] move system_info.py into lbrynet.extras --- lbrynet/extras/cli.py | 2 +- lbrynet/extras/daemon/Daemon.py | 6 +++--- lbrynet/extras/daemon/DaemonControl.py | 5 ++--- lbrynet/extras/daemon/analytics.py | 4 ++-- lbrynet/{ => extras}/system_info.py | 6 +----- tests/unit/test_cli.py | 2 +- 6 files changed, 10 insertions(+), 15 deletions(-) rename lbrynet/{ => extras}/system_info.py (88%) diff --git a/lbrynet/extras/cli.py b/lbrynet/extras/cli.py index 91ebdb447..1d45ddaee 100644 --- a/lbrynet/extras/cli.py +++ b/lbrynet/extras/cli.py @@ -24,7 +24,7 @@ from lbrynet.extras.daemon.Daemon import Daemon from lbrynet.extras.daemon.DaemonControl import start as daemon_main from lbrynet.extras.daemon.DaemonConsole import main as daemon_console from lbrynet.extras.daemon.auth.client import LBRYAPIClient -from lbrynet.system_info import get_platform +from lbrynet.extras.system_info import get_platform async def execute_command(method, params, conf_path=None): diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 00b4c747c..ddb771bd0 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -16,8 +16,8 @@ from twisted.python.failure import Failure from torba.client.baseaccount import SingleKey, HierarchicalDeterministic -from lbrynet import conf, utils, system_info -from lbrynet.system_info import get_lbrynet_version +from lbrynet import conf, utils, __version__ +from lbrynet.extras import system_info from lbrynet.schema.claim import ClaimDict from lbrynet.schema.uri import parse_lbry_uri from lbrynet.schema.error import URIParseError, DecodeError @@ -844,7 +844,7 @@ class Daemon(AuthJSONRPCServer): message, conf.settings.installation_id, platform_name, - get_lbrynet_version() + __version__ ) return self._render_response(True) diff --git a/lbrynet/extras/daemon/DaemonControl.py b/lbrynet/extras/daemon/DaemonControl.py index 8542c86c4..bdaa71dc8 100644 --- a/lbrynet/extras/daemon/DaemonControl.py +++ b/lbrynet/extras/daemon/DaemonControl.py @@ -7,14 +7,13 @@ if 'win' in sys.platform: import certifi os.environ['SSL_CERT_FILE'] = certifi.where() -from lbrynet import log_support import argparse import logging.handlers from twisted.internet import reactor - -from lbrynet import utils, system_info, conf +from lbrynet import utils, conf, log_support +from lbrynet.extras import system_info from .Daemon import Daemon log = logging.getLogger(__name__) diff --git a/lbrynet/extras/daemon/analytics.py b/lbrynet/extras/daemon/analytics.py index 015c1277b..0208d6757 100644 --- a/lbrynet/extras/daemon/analytics.py +++ b/lbrynet/extras/daemon/analytics.py @@ -4,8 +4,8 @@ import logging import treq from twisted.internet import defer, task -from lbrynet import conf, utils, system_info -from lbrynet.extras import looping_call_manager +from lbrynet import conf, utils +from lbrynet.extras import looping_call_manager, system_info # Things We Track SERVER_STARTUP = 'Server Startup' diff --git a/lbrynet/system_info.py b/lbrynet/extras/system_info.py similarity index 88% rename from lbrynet/system_info.py rename to lbrynet/extras/system_info.py index 7e42c25b8..d3552d4f7 100644 --- a/lbrynet/system_info.py +++ b/lbrynet/extras/system_info.py @@ -8,10 +8,6 @@ import logging.handlers log = logging.getLogger(__name__) -def get_lbrynet_version() -> str: - return lbrynet_version - - def get_platform() -> dict: p = { "processor": platform.processor(), @@ -19,7 +15,7 @@ def get_platform() -> dict: "platform": platform.platform(), "os_release": platform.release(), "os_system": platform.system(), - "lbrynet_version": get_lbrynet_version(), + "lbrynet_version": lbrynet_version, "lbryschema_version": schema_version, "build": build_type.BUILD, # CI server sets this during build step } diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 267dcbc15..772b3ae09 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -3,7 +3,7 @@ from io import StringIO from twisted.trial import unittest from lbrynet.extras.cli import normalize_value, main -from lbrynet.system_info import get_platform +from lbrynet.extras.system_info import get_platform class CLITest(unittest.TestCase):