-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·86 lines (71 loc) · 2.54 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python
"""
setup.py file for clucene-bindings
"""
from distutils.core import setup, Extension
import os
dirname=os.path.dirname(__file__)
dirname = os.path.relpath(dirname) if dirname != '' else '.'
def get_pkgconfig_value(param, package):
""" get a value from pkg-config for package
param value: option to pkg-config
"""
try:
f = os.popen("pkg-config %s %s" % (param, package))
x = f.readline().strip()
f.close()
except Exception:
print "Couldn't run 'pkg-config %s %s', check that liblucene++ and pkg-config is properly installed" % (param, package)
exit(1)
# generators: 2.4+ only :(
#return list(y[2:] for y in x.split(" "))
l = []
for y in x.split(" "):
y = y.strip()
if y != '':
l.append(y)
return l
inc_dirs = [dirname + "/include"]
inc_dirs.extend(get_pkgconfig_value('--variable=includedir', 'liblucene++'))
if len(inc_dirs) == 1:
#TODO: remove this when pc file is fixed:
inc_dirs.append('/usr/include/lucene++');
lib_dirs = []
lib_dirs.extend(get_pkgconfig_value('--variable=libdir', 'liblucene++'))
if len(lib_dirs) == 0:
#TODO: remove this when pc file is fixed:
lib_dirs.append('/usr/lib');
luceneLibs = get_pkgconfig_value('--variable=lib', 'liblucene++')
if len(luceneLibs) == 0:
#TODO: remove this when pc file is fixed:
luceneLibs = ['lucene++']
lucene_module = Extension('_lucenepp',
sources=[dirname + '/lucene++PYTHON_wrap.cxx'],
libraries=luceneLibs,
library_dirs=lib_dirs,
include_dirs=inc_dirs,
)
setup (name = 'python-lucene++',
version = '0.4',
author = "Ben van Klinken",
author_email= "[email protected]",
description = """Python bindings for Lucene++""",
license = "Apache Software License",
long_description = """
""",
ext_modules = [lucene_module],
py_modules = ["lucene"],
url = "http://www.github.com/ustramooner",
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Environment :: Web Environment',
'Environment :: Plugins',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP :: Indexing/Search',
'Topic :: Software Development :: Libraries :: Python Modules',
]
)