-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
70 lines (57 loc) · 2.15 KB
/
setup.py
File metadata and controls
70 lines (57 loc) · 2.15 KB
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
import os
import subprocess
import sys
from Cython.Build import cythonize
from setuptools import setup, Extension
VERSION = "0.1.0"
DEBUG = False
def pkgconfig(package, min_version='0'):
flag_map = {"-I": "include_dirs", "-L": "library_dirs", "-l": "libraries"}
kw = {}
try:
tokens = subprocess.check_output(["pkg-config", "--libs", "--cflags", '%s >= %s' % (package, min_version)],
universal_newlines=True)
except subprocess.CalledProcessError:
return {}
for token in tokens.split():
if token[:2] in flag_map:
kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
else:
kw.setdefault("extra_compile_args", []).append(token)
return kw
flags = pkgconfig('libpkgconf')
if not flags:
print('Could not locate libpkgconf, check the PKG_CONFIG_PATH environment variable or perhaps download it:')
print('http://www.pkgconf.org/')
exit()
if DEBUG:
flags['define_macros'] = [('CYTHON_TRACE', '1')]
extensions = [Extension("pkgconf", ["pkgconf.pyx"], **flags)]
setup(
name="pkgconf",
version=VERSION,
description="Python binding for libpkgconf",
platforms=["Linux"],
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: ISC License",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX :: BSD",
"Programming Language :: Cython",
"Programming Language :: C",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
],
author="William Pitcock",
author_email="nenolod@dereferenced.org",
maintainer="William Pitcock",
maintainer_email="nenolod@dereferenced.org",
url="http://github.com/pkgconf/pkgconf-py",
download_url="https://distfiles.dereferenced.org/pkgconf-py/pkgconf-py-%s.tar.gz" % VERSION,
ext_modules=cythonize(extensions, gdb_debug=DEBUG),
setup_requires=["Cython>=0.24.0"],
)