diff --git a/.travis.yml b/.travis.yml index c6f5218ab..fd5530b7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ virtualenv: # We use xvfb for the GTKUI tests before_script: - 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" - echo '2.0.0.dev0' > RELEASE-VERSION diff --git a/deluge/_libtorrent.py b/deluge/_libtorrent.py index 2e41b2809..6926e4095 100644 --- a/deluge/_libtorrent.py +++ b/deluge/_libtorrent.py @@ -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 -supports. - -** Usage ** - ->>> from deluge._libtorrent import lt +Example: + >>> from deluge._libtorrent import lt """ -REQUIRED_VERSION = "1.0.6.0" - - -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) +from deluge.common import VersionSplit, get_version try: import deluge.libtorrent as lt - check_version(lt) except ImportError: 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)) diff --git a/deluge/core/core.py b/deluge/core/core.py index a11e472f9..f558f3f8d 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -57,7 +57,7 @@ class Core(component.Component): client_version.append(0) # 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) # Load the session state if available @@ -948,7 +948,7 @@ class Core(component.Component): :rtype: string """ - return lt.version + return lt.__version__ @export def get_completion_paths(self, args): diff --git a/deluge/ui/baseargparser.py b/deluge/ui/baseargparser.py index aad4cfa33..2693d3dd7 100644 --- a/deluge/ui/baseargparser.py +++ b/deluge/ui/baseargparser.py @@ -88,7 +88,7 @@ def get_version(): version_str = "%s\n" % (common.get_version()) try: from deluge._libtorrent import lt - version_str += "libtorrent: %s\n" % lt.version + version_str += "libtorrent: %s\n" % lt.__version__ except ImportError: pass version_str += "Python: %s\n" % platform.python_version() diff --git a/setup.py b/setup.py index e68d249cc..bc1781054 100755 --- a/setup.py +++ b/setup.py @@ -231,7 +231,7 @@ class Build(_build): _build.run(self) try: from deluge._libtorrent import lt - print('Found libtorrent version: %s' % lt.version) + print('Found libtorrent version: %s' % lt.__version__) except ImportError, e: print('Warning libtorrent not found: %s' % e) diff --git a/tox.ini b/tox.ini index fa5a2f94d..341fce3ac 100644 --- a/tox.ini +++ b/tox.ini @@ -47,7 +47,7 @@ commands = py.test --basetemp=_pytest_temp deluge [testenv:pydef] 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 [testenv:pygtkui]