[Core] Change deprecated lt.version to lt.__version__

This commit is contained in:
Calum Lind 2016-10-17 12:40:28 +01:00
commit 3a8ed2e9cb
6 changed files with 16 additions and 22 deletions

View file

@ -40,7 +40,7 @@ virtualenv:
# We use xvfb for the GTKUI tests # We use xvfb for the GTKUI tests
before_script: before_script:
- export PYTHONPATH=$PYTHONPATH:$PWD - export PYTHONPATH=$PYTHONPATH:$PWD
- python -c "import libtorrent as lt; print lt.version" - python -c "import libtorrent as lt; print lt.__version__"
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
- echo '2.0.0.dev0' > RELEASE-VERSION - echo '2.0.0.dev0' > RELEASE-VERSION

View file

@ -8,28 +8,22 @@
# #
""" """
This module is used to handle the importing of libtorrent. This module is used to handle the importing of libtorrent and also controls
the minimum versions of libtorrent that this version of Deluge supports.
We use this module to control what versions of libtorrent this version of Deluge Example:
supports. >>> from deluge._libtorrent import lt
** Usage **
>>> from deluge._libtorrent import lt
""" """
REQUIRED_VERSION = "1.0.6.0" from deluge.common import VersionSplit, get_version
def check_version(libtorrent):
from deluge.common import VersionSplit
if VersionSplit(libtorrent.version) < VersionSplit(REQUIRED_VERSION):
raise ImportError("This version of Deluge requires libtorrent >=%s!" % REQUIRED_VERSION)
try: try:
import deluge.libtorrent as lt import deluge.libtorrent as lt
check_version(lt)
except ImportError: except ImportError:
import libtorrent as lt import libtorrent as lt
check_version(lt)
REQUIRED_VERSION = "1.0.7.0"
if VersionSplit(lt.__version__) < VersionSplit(REQUIRED_VERSION):
raise ImportError("Deluge %s requires libtorrent >= %s" % (get_version(), REQUIRED_VERSION))

View file

@ -57,7 +57,7 @@ class Core(component.Component):
client_version.append(0) client_version.append(0)
# Start the libtorrent session # Start the libtorrent session
log.info("Starting libtorrent %s (%s, %s) session...", lt.version, client_id, client_version) log.info("Starting libtorrent %s (%s, %s) session...", lt.__version__, client_id, client_version)
self.session = lt.session(lt.fingerprint(client_id, *client_version), flags=0) self.session = lt.session(lt.fingerprint(client_id, *client_version), flags=0)
# Load the session state if available # Load the session state if available
@ -948,7 +948,7 @@ class Core(component.Component):
:rtype: string :rtype: string
""" """
return lt.version return lt.__version__
@export @export
def get_completion_paths(self, args): def get_completion_paths(self, args):

View file

@ -88,7 +88,7 @@ def get_version():
version_str = "%s\n" % (common.get_version()) version_str = "%s\n" % (common.get_version())
try: try:
from deluge._libtorrent import lt from deluge._libtorrent import lt
version_str += "libtorrent: %s\n" % lt.version version_str += "libtorrent: %s\n" % lt.__version__
except ImportError: except ImportError:
pass pass
version_str += "Python: %s\n" % platform.python_version() version_str += "Python: %s\n" % platform.python_version()

View file

@ -231,7 +231,7 @@ class Build(_build):
_build.run(self) _build.run(self)
try: try:
from deluge._libtorrent import lt from deluge._libtorrent import lt
print('Found libtorrent version: %s' % lt.version) print('Found libtorrent version: %s' % lt.__version__)
except ImportError, e: except ImportError, e:
print('Warning libtorrent not found: %s' % e) print('Warning libtorrent not found: %s' % e)

View file

@ -47,7 +47,7 @@ commands = py.test --basetemp=_pytest_temp deluge
[testenv:pydef] [testenv:pydef]
commands = commands =
python -c "import libtorrent as lt; print lt.version" python -c "import libtorrent as lt; print lt.__version__"
py.test -v --basetemp=_pytest_temp -s -m "not (todo or gtkui)" deluge/tests py.test -v --basetemp=_pytest_temp -s -m "not (todo or gtkui)" deluge/tests
[testenv:pygtkui] [testenv:pygtkui]