general incomplete porting of daemon booting ~> py3

This commit is contained in:
Victor Shyba 2018-07-17 21:35:53 -03:00 committed by Jack Robison
parent 07a12b66e8
commit 78c560a3be
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
4 changed files with 22 additions and 16 deletions

View file

@ -313,7 +313,7 @@ class Config(object):
environment=None, cli_settings=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._fixed_defaults = fixed_defaults
@ -517,7 +517,7 @@ class Config(object):
@staticmethod
def _convert_conf_file_lists_reverse(converted):
rev = {}
for k in converted.iterkeys():
for k in converted.keys():
if k in ADJUSTABLE_SETTINGS and len(ADJUSTABLE_SETTINGS[k]) == 4:
rev[k] = ADJUSTABLE_SETTINGS[k][3](converted[k])
else:
@ -527,7 +527,7 @@ class Config(object):
@staticmethod
def _convert_conf_file_lists(decoded):
converted = {}
for k, v in decoded.iteritems():
for k, v in decoded.items():
if k in ADJUSTABLE_SETTINGS and len(ADJUSTABLE_SETTINGS[k]) >= 3:
converted[k] = ADJUSTABLE_SETTINGS[k][2](v)
else:

View file

@ -20,7 +20,7 @@ def get_lbrynet_version():
return subprocess.check_output(
['git', '--git-dir='+git_dir, 'describe', '--dirty', '--always'],
stderr=devnull
).strip().lstrip('v')
).decode().strip().lstrip('v')
except (subprocess.CalledProcessError, OSError):
print("failed to get version from git")
return lbrynet_version

View file

@ -1,4 +1,5 @@
import base64
import codecs
import datetime
import random
import socket
@ -88,12 +89,16 @@ def version_is_greater_than(a, 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):
return base64.b64decode(obfustacated.decode('rot13'))
return base64.b64decode(rot13(obfustacated))
def obfuscate(plain):
return base64.b64encode(plain).encode('rot13')
return rot13(base64.b64encode(plain))
def check_connection(server="lbry.io", port=80, timeout=2):

View file

@ -12,8 +12,8 @@ from lbrynet.core import log_support
import argparse
import logging.handlers
from twisted.internet import reactor
from jsonrpc.proxy import JSONRPCProxy
from twisted.internet import defer, reactor
#from jsonrpc.proxy import JSONRPCProxy
from lbrynet import conf
from lbrynet.core import utils, system_info
@ -65,7 +65,7 @@ def start():
if args.version:
version = system_info.get_platform(get_ip=False)
version['installation_id'] = conf.settings.installation_id
print utils.json_dumps_pretty(version)
print(utils.json_dumps_pretty(version))
return
lbrynet_log = conf.settings.get_log_filename()
@ -73,13 +73,14 @@ def start():
log_support.configure_loggly_handler()
log.debug('Final Settings: %s', conf.settings.get_current_settings_dict())
try:
log.debug('Checking for an existing lbrynet daemon instance')
JSONRPCProxy.from_url(conf.settings.get_api_connection_string()).status()
log.info("lbrynet-daemon is already running")
return
except Exception:
log.debug('No lbrynet instance found, continuing to start')
# fixme: fix that, JSONRPCProxy is gone on py3
#try:
# log.debug('Checking for an existing lbrynet daemon instance')
# JSONRPCProxy.from_url(conf.settings.get_api_connection_string()).status()
# log.info("lbrynet-daemon is already running")
# return
#except Exception:
# log.debug('No lbrynet instance found, continuing to start')
log.info("Starting lbrynet-daemon from command line")