forked from ebroder/pyafs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·54 lines (49 loc) · 1.7 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
#!/usr/bin/python
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import sys
import os
for root in ['/Library/OpenAFS/Tools',
'/usr/local',
'/usr/afsws',
'/usr']:
if os.path.exists('%s/include/afs/afs.h' % root):
break
include_dirs = [os.path.join(os.path.dirname(__file__), 'afs'),
'%s/include' % root]
library_dirs = ['%s/lib' % root,
'%s/lib/afs' % root]
if os.path.exists('%s/lib/libafsauthent_pic.a' % root) or os.path.exists('%s/lib64/libafsauthent_pic.a' % root):
suffix = '_pic'
else:
suffix = ''
libraries = ['afsauthent%s' % suffix, 'afsrpc%s' % suffix, 'resolv']
define_macros = [('AFS_PTHREAD_ENV', None)]
def PyAFSExtension(module, *args, **kwargs):
kwargs.setdefault('libraries', []).extend(libraries)
kwargs.setdefault('include_dirs', []).extend(include_dirs)
kwargs.setdefault('library_dirs', []).extend(library_dirs)
kwargs.setdefault('define_macros', []).extend(define_macros)
return Extension(module,
["%s.pyx" % module.replace('.', '/')],
*args,
**kwargs)
setup(
name="PyAFS",
version="0.1.1",
description="PyAFS - Python bindings for AFS",
author="Evan Broder",
author_email="[email protected]",
url="http://github.com/ebroder/pyafs/",
license="GPL",
requires=['Cython'],
packages=['afs', 'afs.tests'],
ext_modules=[
PyAFSExtension("afs._util"),
PyAFSExtension("afs._acl"),
PyAFSExtension("afs._fs"),
PyAFSExtension("afs._pts", libraries=['krb5']),
],
cmdclass= {"build_ext": build_ext}
)