-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup.py
65 lines (56 loc) · 1.85 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
import os.path
import subprocess
from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.sdist import sdist
def install_libc_headers_and(cmdclass):
def download_fake_libc_include():
inc = os.path.join('autopxd', 'include')
if os.path.exists(inc):
if not os.path.isdir(inc):
raise Exception(
'"{0}" already exists and is not a directory'.format(inc))
return
repo = 'https://github.com/eliben/pycparser'
commit = 'a47b919287a33dea55cc02b2f8c5f4be2ee8613c'
url = '{0}/archive/{1}.tar.gz'.format(repo, commit)
subprocess.check_call((
'mkdir {0} && cd {0} && '
'curl -L -o - {1} | '
'tar xfz - --strip-components=3 '
'pycparser-{2}/utils/fake_libc_include/'
).format(inc, url, commit), shell=True)
class Sub(cmdclass):
def run(self):
download_fake_libc_include()
cmdclass.run(self)
return Sub
VERSION = '1.1.2'
REPO = 'http://github.com/tarruda/python-autopxd'
setup(
name='autopxd',
version=VERSION,
description='Automatically generate Cython pxd files from C headers',
packages=['autopxd'],
package_data={'autopxd': ['include/*.h', 'include/**/*.h']},
author='Thiago de Arruda',
author_email='[email protected]',
url=REPO,
download_url='{0}/archive/{1}.tar.gz'.format(REPO, VERSION),
license='MIT',
cmdclass={
'develop': install_libc_headers_and(develop),
'install': install_libc_headers_and(install),
'sdist': install_libc_headers_and(sdist)
},
install_requires=[
'six',
'Click',
'pycparser',
],
entry_points='''
[console_scripts]
autopxd=autopxd:cli
''',
)