general incomplete porting of daemon booting ~> py3
This commit is contained in:
parent
07a12b66e8
commit
78c560a3be
4 changed files with 22 additions and 16 deletions
|
@ -313,7 +313,7 @@ class Config(object):
|
||||||
environment=None, cli_settings=None):
|
environment=None, cli_settings=None):
|
||||||
|
|
||||||
self._installation_id = None
|
self._installation_id = None
|
||||||
self._session_id = base58.b58encode(utils.generate_id())
|
self._session_id = base58.b58encode(utils.generate_id()).decode()
|
||||||
self._node_id = None
|
self._node_id = None
|
||||||
|
|
||||||
self._fixed_defaults = fixed_defaults
|
self._fixed_defaults = fixed_defaults
|
||||||
|
@ -517,7 +517,7 @@ class Config(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _convert_conf_file_lists_reverse(converted):
|
def _convert_conf_file_lists_reverse(converted):
|
||||||
rev = {}
|
rev = {}
|
||||||
for k in converted.iterkeys():
|
for k in converted.keys():
|
||||||
if k in ADJUSTABLE_SETTINGS and len(ADJUSTABLE_SETTINGS[k]) == 4:
|
if k in ADJUSTABLE_SETTINGS and len(ADJUSTABLE_SETTINGS[k]) == 4:
|
||||||
rev[k] = ADJUSTABLE_SETTINGS[k][3](converted[k])
|
rev[k] = ADJUSTABLE_SETTINGS[k][3](converted[k])
|
||||||
else:
|
else:
|
||||||
|
@ -527,7 +527,7 @@ class Config(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _convert_conf_file_lists(decoded):
|
def _convert_conf_file_lists(decoded):
|
||||||
converted = {}
|
converted = {}
|
||||||
for k, v in decoded.iteritems():
|
for k, v in decoded.items():
|
||||||
if k in ADJUSTABLE_SETTINGS and len(ADJUSTABLE_SETTINGS[k]) >= 3:
|
if k in ADJUSTABLE_SETTINGS and len(ADJUSTABLE_SETTINGS[k]) >= 3:
|
||||||
converted[k] = ADJUSTABLE_SETTINGS[k][2](v)
|
converted[k] = ADJUSTABLE_SETTINGS[k][2](v)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -20,7 +20,7 @@ def get_lbrynet_version():
|
||||||
return subprocess.check_output(
|
return subprocess.check_output(
|
||||||
['git', '--git-dir='+git_dir, 'describe', '--dirty', '--always'],
|
['git', '--git-dir='+git_dir, 'describe', '--dirty', '--always'],
|
||||||
stderr=devnull
|
stderr=devnull
|
||||||
).strip().lstrip('v')
|
).decode().strip().lstrip('v')
|
||||||
except (subprocess.CalledProcessError, OSError):
|
except (subprocess.CalledProcessError, OSError):
|
||||||
print("failed to get version from git")
|
print("failed to get version from git")
|
||||||
return lbrynet_version
|
return lbrynet_version
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import base64
|
import base64
|
||||||
|
import codecs
|
||||||
import datetime
|
import datetime
|
||||||
import random
|
import random
|
||||||
import socket
|
import socket
|
||||||
|
@ -88,12 +89,16 @@ def version_is_greater_than(a, b):
|
||||||
return pkg_resources.parse_version(a) > pkg_resources.parse_version(b)
|
return pkg_resources.parse_version(a) > pkg_resources.parse_version(b)
|
||||||
|
|
||||||
|
|
||||||
|
def rot13(some_str):
|
||||||
|
return codecs.encode(some_str, 'rot_13')
|
||||||
|
|
||||||
|
|
||||||
def deobfuscate(obfustacated):
|
def deobfuscate(obfustacated):
|
||||||
return base64.b64decode(obfustacated.decode('rot13'))
|
return base64.b64decode(rot13(obfustacated))
|
||||||
|
|
||||||
|
|
||||||
def obfuscate(plain):
|
def obfuscate(plain):
|
||||||
return base64.b64encode(plain).encode('rot13')
|
return rot13(base64.b64encode(plain))
|
||||||
|
|
||||||
|
|
||||||
def check_connection(server="lbry.io", port=80, timeout=2):
|
def check_connection(server="lbry.io", port=80, timeout=2):
|
||||||
|
|
|
@ -12,8 +12,8 @@ from lbrynet.core import log_support
|
||||||
import argparse
|
import argparse
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import defer, reactor
|
||||||
from jsonrpc.proxy import JSONRPCProxy
|
#from jsonrpc.proxy import JSONRPCProxy
|
||||||
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.core import utils, system_info
|
from lbrynet.core import utils, system_info
|
||||||
|
@ -65,7 +65,7 @@ def start():
|
||||||
if args.version:
|
if args.version:
|
||||||
version = system_info.get_platform(get_ip=False)
|
version = system_info.get_platform(get_ip=False)
|
||||||
version['installation_id'] = conf.settings.installation_id
|
version['installation_id'] = conf.settings.installation_id
|
||||||
print utils.json_dumps_pretty(version)
|
print(utils.json_dumps_pretty(version))
|
||||||
return
|
return
|
||||||
|
|
||||||
lbrynet_log = conf.settings.get_log_filename()
|
lbrynet_log = conf.settings.get_log_filename()
|
||||||
|
@ -73,13 +73,14 @@ def start():
|
||||||
log_support.configure_loggly_handler()
|
log_support.configure_loggly_handler()
|
||||||
log.debug('Final Settings: %s', conf.settings.get_current_settings_dict())
|
log.debug('Final Settings: %s', conf.settings.get_current_settings_dict())
|
||||||
|
|
||||||
try:
|
# fixme: fix that, JSONRPCProxy is gone on py3
|
||||||
log.debug('Checking for an existing lbrynet daemon instance')
|
#try:
|
||||||
JSONRPCProxy.from_url(conf.settings.get_api_connection_string()).status()
|
# log.debug('Checking for an existing lbrynet daemon instance')
|
||||||
log.info("lbrynet-daemon is already running")
|
# JSONRPCProxy.from_url(conf.settings.get_api_connection_string()).status()
|
||||||
return
|
# log.info("lbrynet-daemon is already running")
|
||||||
except Exception:
|
# return
|
||||||
log.debug('No lbrynet instance found, continuing to start')
|
#except Exception:
|
||||||
|
# log.debug('No lbrynet instance found, continuing to start')
|
||||||
|
|
||||||
log.info("Starting lbrynet-daemon from command line")
|
log.info("Starting lbrynet-daemon from command line")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue