forked from LBRYCommunity/lbry-sdk
use git version when in dev
This commit is contained in:
parent
e19e2f3609
commit
cd16383fa6
3 changed files with 27 additions and 9 deletions
|
@ -10,6 +10,8 @@ from lbrynet.core import utils
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
ENV_NAMESPACE = 'LBRY_'
|
ENV_NAMESPACE = 'LBRY_'
|
||||||
|
|
||||||
LBRYCRD_WALLET = 'lbrycrd'
|
LBRYCRD_WALLET = 'lbrycrd'
|
||||||
|
|
|
@ -1,14 +1,30 @@
|
||||||
import platform
|
import platform
|
||||||
import json
|
import json
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
|
||||||
from urllib2 import urlopen
|
from urllib2 import urlopen
|
||||||
|
|
||||||
from lbrynet import __version__ as lbrynet_version
|
from lbrynet import build_type, __version__ as lbrynet_version
|
||||||
from lbrynet import build_type
|
from lbrynet.conf import ROOT_DIR
|
||||||
from lbryum.version import LBRYUM_VERSION as lbryum_version
|
from lbryum.version import LBRYUM_VERSION
|
||||||
from lbryschema import __version__ as lbryschema_version
|
from lbryschema import __version__ as lbryschema_version
|
||||||
|
|
||||||
|
|
||||||
|
def get_lbrynet_version():
|
||||||
|
if build_type.BUILD == "dev":
|
||||||
|
try:
|
||||||
|
with open(os.devnull, 'w') as devnull:
|
||||||
|
git_dir = ROOT_DIR + '/.git'
|
||||||
|
return subprocess.check_output(
|
||||||
|
['git', '--git-dir='+git_dir, 'describe', '--dirty', '--always'],
|
||||||
|
stderr=devnull
|
||||||
|
).strip()
|
||||||
|
except (subprocess.CalledProcessError, OSError):
|
||||||
|
print "failed to get version from git"
|
||||||
|
return lbrynet_version
|
||||||
|
|
||||||
|
|
||||||
def get_platform(get_ip=True):
|
def get_platform(get_ip=True):
|
||||||
p = {
|
p = {
|
||||||
"processor": platform.processor(),
|
"processor": platform.processor(),
|
||||||
|
@ -16,8 +32,8 @@ def get_platform(get_ip=True):
|
||||||
"platform": platform.platform(),
|
"platform": platform.platform(),
|
||||||
"os_release": platform.release(),
|
"os_release": platform.release(),
|
||||||
"os_system": platform.system(),
|
"os_system": platform.system(),
|
||||||
"lbrynet_version": lbrynet_version,
|
"lbrynet_version": get_lbrynet_version(),
|
||||||
"lbryum_version": lbryum_version,
|
"lbryum_version": LBRYUM_VERSION,
|
||||||
"lbryschema_version": lbryschema_version,
|
"lbryschema_version": lbryschema_version,
|
||||||
"build": build_type.BUILD, # CI server sets this during build step
|
"build": build_type.BUILD, # CI server sets this during build step
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ from lbryschema.error import URIParseError
|
||||||
|
|
||||||
# TODO: importing this when internet is disabled raises a socket.gaierror
|
# TODO: importing this when internet is disabled raises a socket.gaierror
|
||||||
from lbryum.version import LBRYUM_VERSION
|
from lbryum.version import LBRYUM_VERSION
|
||||||
from lbrynet import __version__ as LBRYNET_VERSION
|
from lbrynet.core.system_info import get_lbrynet_version
|
||||||
from lbrynet import conf, analytics
|
from lbrynet import conf, analytics
|
||||||
from lbrynet.conf import LBRYCRD_WALLET, LBRYUM_WALLET, PTC_WALLET
|
from lbrynet.conf import LBRYCRD_WALLET, LBRYUM_WALLET, PTC_WALLET
|
||||||
from lbrynet.reflector import reupload
|
from lbrynet.reflector import reupload
|
||||||
|
@ -178,8 +178,8 @@ class Daemon(AuthJSONRPCServer):
|
||||||
'is_running', 'is_first_run', 'get_time_behind_blockchain', 'daemon_status',
|
'is_running', 'is_first_run', 'get_time_behind_blockchain', 'daemon_status',
|
||||||
'get_start_notice',
|
'get_start_notice',
|
||||||
]
|
]
|
||||||
last_version = {'last_version': {'lbrynet': LBRYNET_VERSION, 'lbryum': LBRYUM_VERSION}}
|
conf.settings.set('last_version',
|
||||||
conf.settings.update(last_version)
|
{'lbrynet': get_lbrynet_version(), 'lbryum': LBRYUM_VERSION})
|
||||||
self.db_dir = conf.settings['data_dir']
|
self.db_dir = conf.settings['data_dir']
|
||||||
self.download_directory = conf.settings['download_directory']
|
self.download_directory = conf.settings['download_directory']
|
||||||
if conf.settings['BLOBFILES_DIR'] == "blobfiles":
|
if conf.settings['BLOBFILES_DIR'] == "blobfiles":
|
||||||
|
@ -1159,7 +1159,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
message,
|
message,
|
||||||
conf.settings.installation_id,
|
conf.settings.installation_id,
|
||||||
platform_name,
|
platform_name,
|
||||||
LBRYNET_VERSION
|
get_lbrynet_version()
|
||||||
)
|
)
|
||||||
return self._render_response(True)
|
return self._render_response(True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue