forked from VowpalWabbit/vowpal_wabbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
66 lines (55 loc) · 2.14 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
import shutil
import subprocess
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
from distutils.command.clean import clean as _clean
VERSION = None
with open("configure.ac") as f:
for line in f:
line = line.strip()
if 'AC_INIT(' in line:
VERSION = line.split(",")[1].replace("[", "").replace("]", "").strip()
if not VERSION:
raise Exception("VowPal Wabbit version not found in '%s'" % CONFIG_H)
class VWBuildExt(_build_ext):
def build_extension(self, ext):
subprocess.check_call(["make", "python"])
target_dir = os.path.dirname(self.get_ext_fullpath(ext.name))
if not os.path.isdir(target_dir):
os.makedirs(target_dir)
shutil.copy(os.path.join("python", "%s.so" % ext.name), self.get_ext_fullpath(ext.name))
class VWClean(_clean):
def run(self):
_clean.run(self)
subprocess.check_call(["make", "clean"])
pylibvw = Extension('pylibvw', sources=['python/pylibvw.cc'])
setup(
name="pyvw",
version=VERSION,
url="https://github.com/JohnLangford/vowpal_wabbit",
maintainer="trbs",
maintainer_email="[email protected]",
description="The Vowpal Wabbit (VW) project is a fast out-of-core learning system.",
long_description="""PIP Installable version of Vowpal Wabbit.
You need to have boost (libboost-program-options-dev and libboost-python-dev) and python
development packages installed on your system for it to build correctly. See the Vowpal Wabbit
side for more information about building VW.
Since the pyvw wrapper bundled with Vowpal Wabbit links statically to libvw.a this package will
always build it's own library and (currently) cannot use the system installed libvw.so provided
by distribution packages.
""",
package_dir={'': 'python'},
py_modules=['pyvw'],
ext_modules=[pylibvw],
cmdclass={
'build_ext': VWBuildExt,
'clean': VWClean,
},
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Topic :: Scientific/Engineering',
],
)