3 from distutils.core import setup
4 from distutils.extension import Extension
5 from Cython.Distutils import build_ext
9 for root in ['/Library/OpenAFS/Tools',
13 if os.path.exists('%s/include/afs/afs.h' % root):
16 include_dirs = [os.path.join(os.path.dirname(__file__), 'afs'),
18 library_dirs = ['%s/lib' % root,
20 if os.path.exists('%s/lib/libafsauthent_pic.a' % root):
24 libraries = ['afsauthent%s' % suffix, 'afsrpc%s' % suffix, 'resolv']
25 define_macros = [('AFS_PTHREAD_ENV', None)]
27 def PyAFSExtension(module, *args, **kwargs):
28 kwargs.setdefault('libraries', []).extend(libraries)
29 kwargs.setdefault('include_dirs', []).extend(include_dirs)
30 kwargs.setdefault('library_dirs', []).extend(library_dirs)
31 kwargs.setdefault('define_macros', []).extend(define_macros)
32 return Extension(module,
33 ["%s.pyx" % module.replace('.', '/')],
40 description="PyAFS - Python bindings for AFS",
42 author_email="broder@mit.edu",
45 packages=['afs', 'afs.tests'],
47 PyAFSExtension("afs.afs"),
48 PyAFSExtension("afs._pts"),
49 PyAFSExtension("afs._acl"),
51 cmdclass= {"build_ext": build_ext}