forked from premiere/premiere-libtorrent
updated setup.py and documentation for python bindings (thanks will guaraldi)
This commit is contained in:
parent
8995edead0
commit
c0f82a730e
|
@ -2,6 +2,7 @@
|
|||
|
||||
from distutils.core import setup, Extension
|
||||
import commands
|
||||
import os
|
||||
|
||||
def pkgconfig(*packages, **kw):
|
||||
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries' }
|
||||
|
@ -14,40 +15,25 @@ def pkgconfig(*packages, **kw):
|
|||
kw[k] = list(set(v))
|
||||
return kw
|
||||
|
||||
def build_extension():
|
||||
this_dir = os.path.dirname(__file__)
|
||||
source_list = os.listdir(os.path.join(this_dir, "src"))
|
||||
source_list = [os.path.join("src", s) for s in source_list if s.endswith(".cpp")]
|
||||
|
||||
ltmod = Extension(
|
||||
'libtorrent',
|
||||
sources = [ 'src/alert.cpp',
|
||||
'src/big_number.cpp',
|
||||
'src/converters.cpp',
|
||||
'src/datetime.cpp',
|
||||
'src/docstrings.cpp',
|
||||
'src/entry.cpp',
|
||||
'src/extensions.cpp',
|
||||
'src/filesystem.cpp',
|
||||
'src/fingerprint.cpp',
|
||||
'src/ip_filter.cpp',
|
||||
'src/magnet_uri.cpp',
|
||||
'src/module.cpp',
|
||||
'src/peer_info.cpp',
|
||||
'src/peer_plugin.cpp',
|
||||
'src/session.cpp',
|
||||
'src/session_settings.cpp',
|
||||
'src/torrent.cpp',
|
||||
'src/torrent_handle.cpp',
|
||||
'src/torrent_info.cpp',
|
||||
'src/torrent_status.cpp',
|
||||
'src/utility.cpp',
|
||||
'src/version.cpp' ],
|
||||
**pkgconfig('libtorrent-rasterbar',
|
||||
libraries = [ 'boost_python-mt-1_35' ],
|
||||
)
|
||||
);
|
||||
libtorrent_pkg_config = pkgconfig('libtorrent-rasterbar', libraries=['boost_python-mt'])
|
||||
|
||||
setup( name = 'py-libtorrent',
|
||||
version = '0.14',
|
||||
description = 'Python bindings for libtorrent (rasterbar)',
|
||||
author = 'Arvid Norberg',
|
||||
ext_modules = [ltmod],
|
||||
include_dirs = ['/opt/local/include/boost-1_35'])
|
||||
return Extension(
|
||||
'libtorrent',
|
||||
sources = source_list,
|
||||
**libtorrent_pkg_config
|
||||
)
|
||||
|
||||
libtorrent_extension = build_extension()
|
||||
|
||||
setup( name = 'py-libtorrent',
|
||||
version = '0.14',
|
||||
description = 'Python bindings for libtorrent (rasterbar)',
|
||||
author = 'Arvid Norberg',
|
||||
url = 'http://www.rasterbar.com/products/libtorrent/index.html',
|
||||
ext_modules = [libtorrent_extension]
|
||||
)
|
||||
|
|
|
@ -14,8 +14,29 @@ building
|
|||
Building the libtorrent python bindings will produce a shared library (DLL)
|
||||
which is a python module that can be imported in a python program.
|
||||
|
||||
The only supported build system for the bindings are currently boost build. To
|
||||
set up your build environment, you need to add some settings to your
|
||||
building using setup.py
|
||||
-----------------------
|
||||
|
||||
To set up the Python bindings for libtorrent, you must first have libtorrent
|
||||
built and installed on the system. See 'building libtorrent'_.
|
||||
|
||||
.. _`building libtorrent`: building.html
|
||||
|
||||
To build the Python bindings do:
|
||||
|
||||
1. Run::
|
||||
|
||||
python setup.py build
|
||||
|
||||
2. As root, run::
|
||||
|
||||
python setup.py install
|
||||
|
||||
|
||||
building using boost build
|
||||
--------------------------
|
||||
|
||||
To set up your build environment, you need to add some settings to your
|
||||
``$BOOST_BUILD_PATH/user-config.jam``.
|
||||
|
||||
Make sure your user config contains the following line::
|
||||
|
|
Loading…
Reference in New Issue