From 5d82cf8f872e5b5ae1de3023cd0f895dc85da3e5 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 30 Nov 2008 01:11:26 +0000 Subject: [PATCH] Better libtorrent check in setup --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0d7d7a573..ca64d88e6 100644 --- a/setup.py +++ b/setup.py @@ -176,7 +176,18 @@ for source in _sources: break _ext_modules = [] -if windows_check() or not os.path.exists(os.path.join(sysconfig.get_config_var("LIBDIR"), "libtorrent-rasterbar.so.1")): + +# Check for a system libtorrent and if found, then do not build the libtorrent extension +build_libtorrent = True +try: + import libtorrent +except ImportError: + build_libtorrent = True +else: + if libtorrent.version_major == 0 and libtorrent.version_minor == 14: + build_libtorrent = False + +if build_libtorrent: # There isn't a system libtorrent library, so let's build the one included with deluge libtorrent = Extension( 'libtorrent',