From a9821216bfdc2b0967ec0f65bb09adee9e9edb8a Mon Sep 17 00:00:00 2001 From: arvidn Date: Wed, 23 Sep 2015 09:13:00 -0700 Subject: [PATCH] revert py_libtorrent renaming for python binding --- .travis.yml | 12 +++++++++--- Jamfile | 3 +-- appveyor.yml | 2 +- bindings/python/Jamfile | 5 ++--- bindings/python/setup.py | 2 +- bindings/python/src/module.cpp | 2 +- bindings/python/test.py | 6 +----- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0894ea7b8..4e94183c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,9 +64,15 @@ script: - bjam --hash -j3 warnings-as-errors=on variant=$variant -l900 $toolset $target - cd ../examples - bjam --hash -j3 warnings-as-errors=on variant=$variant $toolset link=shared - - cd ../bindings/python - - bjam --hash -j3 warnings-as-errors=on variant=$variant $toolset stage_module libtorrent-link=shared - - LD_LIBRARY_PATH=. DYLD_LIBRARY_PATH=. python test.py + - cd .. +# build libtorrent separately and install it in a temporary (well known) dir +# we have to do this because on linux the name of the python module is the same +# as the main library, so we can't stage them to the same directory + - bjam --hash -j3 warnings-as-errors=on link=shared variant=$variant $toolset install location=./lib + - cd bindings/python +# here we specify the temporary lib dir as a path to look for the main library + - bjam --hash -j3 warnings-as-errors=on variant=$variant $toolset stage_module libtorrent-link=shared dll-path=../../lib + - LD_LIBRARY_PATH=../../lib DYLD_LIBRARY_PATH=../../lib python test.py - if [ $sim = "1" ]; then cd ../../simulation; bjam --hash -j2 crypto=built-in $toolset; diff --git a/Jamfile b/Jamfile index aaf82fd64..f6e9a70cc 100644 --- a/Jamfile +++ b/Jamfile @@ -799,8 +799,7 @@ lib torrent headers = [ path.glob-tree include/libtorrent : *.hpp ] ; package.install install - : libtorrent - on + : LIB : : torrent : $(headers) diff --git a/appveyor.yml b/appveyor.yml index 0ccdab64d..a21bc7315 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -114,7 +114,7 @@ build_script: & cd %ROOT_DIRECTORY%\examples & b2.exe --hash -j2 %compiler% variant=%variant% linkflags=%linkflags% include=%include% link=shared & cd %ROOT_DIRECTORY%\bindings\python - & b2.exe --hash -j2 %compiler% stage_module variant=%variant% libtorrent-link=shared linkflags=%linkflags% include=%include% + & b2.exe --hash -j2 %compiler% stage_module install-dependencies=on variant=%variant% libtorrent-link=shared linkflags=%linkflags% include=%include% & python test.py ) - if defined sim ( diff --git a/bindings/python/Jamfile b/bindings/python/Jamfile index e5a055cdf..c650bd15d 100644 --- a/bindings/python/Jamfile +++ b/bindings/python/Jamfile @@ -123,7 +123,7 @@ rule my-python-extension ( name : sources * : requirements * : default-build * : ] ; } -my-python-extension py_libtorrent +my-python-extension libtorrent : # sources src/module.cpp src/big_number.cpp @@ -157,9 +157,8 @@ my-python-extension py_libtorrent ; install stage_module - : py_libtorrent + : libtorrent : . - on LIB ; diff --git a/bindings/python/setup.py b/bindings/python/setup.py index a7b254ad9..47cf0c165 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -85,7 +85,7 @@ if '--bjam' in sys.argv: except: pass try: os.mkdir('libtorrent') except: pass - shutil.copyfile('py_libtorrent' + file_ext, 'build/lib/libtorrent' + file_ext) + shutil.copyfile('libtorrent' + file_ext, 'build/lib/libtorrent' + file_ext) packages = ['libtorrent'] diff --git a/bindings/python/src/module.cpp b/bindings/python/src/module.cpp index 1146e377f..d64fae6c9 100644 --- a/bindings/python/src/module.cpp +++ b/bindings/python/src/module.cpp @@ -29,7 +29,7 @@ void bind_converters(); void bind_create_torrent(); void bind_error_code(); -BOOST_PYTHON_MODULE(py_libtorrent) +BOOST_PYTHON_MODULE(libtorrent) { Py_Initialize(); PyEval_InitThreads(); diff --git a/bindings/python/test.py b/bindings/python/test.py index f1d851a55..a3e4b5dbf 100644 --- a/bindings/python/test.py +++ b/bindings/python/test.py @@ -1,10 +1,6 @@ #!/usr/bin/env python -# this name "py_libtorrent" is the name produced by the Jamfile. The setup.py -# will actually name it libtorrent for the distro. It's only called -# py_libtorrent here to be able to coexist with the main libtorrent.so on linux -# (which otherwise would have the same name in the same directory) -import py_libtorrent as lt +import libtorrent as lt import unittest