Use a constant for versions
This commit is contained in:
parent
4e79ed8124
commit
12f7345d0c
|
@ -25,6 +25,7 @@ except ImportError:
|
|||
import libtorrent as lt
|
||||
|
||||
REQUIRED_VERSION = '1.1.2.0'
|
||||
LT_VERSION = lt.__version__
|
||||
|
||||
if VersionSplit(lt.__version__) < VersionSplit(REQUIRED_VERSION):
|
||||
if VersionSplit(LT_VERSION) < VersionSplit(REQUIRED_VERSION):
|
||||
raise ImportError('Deluge %s requires libtorrent >= %s' % (get_version(), REQUIRED_VERSION))
|
||||
|
|
|
@ -24,7 +24,7 @@ from twisted.web.client import getPage
|
|||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge import path_chooser_common
|
||||
from deluge._libtorrent import lt
|
||||
from deluge._libtorrent import lt, LT_VERSION
|
||||
from deluge.common import PY2
|
||||
from deluge.configmanager import ConfigManager, get_config_dir
|
||||
from deluge.core.alertmanager import AlertManager
|
||||
|
@ -97,6 +97,8 @@ SESSION_RATES_MAPPING = {
|
|||
'upload_rate': 'net.sent_bytes',
|
||||
}
|
||||
|
||||
DELUGE_VER = deluge.common.get_version()
|
||||
|
||||
|
||||
class Core(component.Component):
|
||||
def __init__(self, listen_interface=None, read_only_config_keys=None):
|
||||
|
@ -1058,7 +1060,7 @@ class Core(component.Component):
|
|||
:rtype: string
|
||||
|
||||
"""
|
||||
return lt.__version__
|
||||
return LT_VERSION
|
||||
|
||||
@export
|
||||
def get_completion_paths(self, args):
|
||||
|
|
|
@ -89,8 +89,8 @@ argparse.ArgumentParser.set_default_subparser = set_default_subparser
|
|||
def get_version():
|
||||
version_str = '%s\n' % (common.get_version())
|
||||
try:
|
||||
from deluge._libtorrent import lt
|
||||
version_str += 'libtorrent: %s\n' % lt.__version__
|
||||
from deluge._libtorrent import LT_VERSION
|
||||
version_str += 'libtorrent: %s\n' % LT_VERSION
|
||||
except ImportError:
|
||||
pass
|
||||
version_str += 'Python: %s\n' % platform.python_version()
|
||||
|
|
4
setup.py
4
setup.py
|
@ -360,8 +360,8 @@ class Build(_build):
|
|||
# Run all sub-commands (at least those that need to be run).
|
||||
_build.run(self)
|
||||
try:
|
||||
from deluge._libtorrent import lt
|
||||
print('Info: Found libtorrent ({}) installed.'.format(lt.__version__))
|
||||
from deluge._libtorrent import LT_VERSION
|
||||
print('Info: Found libtorrent ({}) installed.'.format(LT_VERSION))
|
||||
except ImportError as ex:
|
||||
print('Warning: libtorrent (libtorrent-rasterbar) not found: %s' % ex)
|
||||
|
||||
|
|
Loading…
Reference in New Issue