-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
41 lines (38 loc) · 1.28 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
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import subprocess as sp
import sys
def pkgconfig(*packages, **kw):
flag_map = {'-I': 'include_dirs',
'-L': 'library_dirs',
'-l': 'libraries'}
cmd = ["pkg-config", "--libs", "--cflags"]
cmd.extend(packages)
try:
out = sp.check_output(cmd, universal_newlines=True)
except:
raise SystemExit("libmdb (or pkg-config) is not installed! Aborting...")
kw = {}
for token in out.split():
kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
return kw
setup(
name='mdbread',
version='0.1.1',
description='Reader for MS Access MDB files.',
author='Cory Giles',
author_email='[email protected]',
url='http://corygil.es/',
cmdclass={'build_ext': build_ext},
ext_modules = [Extension("mdbread", ["mdbread.pyx"],
**pkgconfig("libmdb"))],
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: POSIX",
"Operating System :: MacOS X",
"License :: OSI Approved :: MIT License",
"Topic :: Database"]
)