Initial commit of something that builds.
authorEvan Broder <broder@mit.edu>
Sun, 21 Dec 2008 08:55:41 +0000 (02:55 -0600)
committerEvan Broder <broder@mit.edu>
Sun, 21 Dec 2008 10:13:03 +0000 (04:13 -0600)
Signed-off-by: Evan Broder <broder@mit.edu>

.gitignore [new file with mode: 0644]
afs/__init__.py [new file with mode: 0644]
afs/_pts.pyx [new file with mode: 0644]
setup.py [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..26041b4
--- /dev/null
@@ -0,0 +1,6 @@
+afs/_pts.c
+*.so
+build
+dist
+*.pyc
+PyAFS.egg-info
diff --git a/afs/__init__.py b/afs/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/afs/_pts.pyx b/afs/_pts.pyx
new file mode 100644 (file)
index 0000000..49ee9b6
--- /dev/null
@@ -0,0 +1,24 @@
+cdef extern from "afs/stds.h":
+    ctypedef long afs_int32
+
+cdef extern from "ubik.h":
+    enum:
+        MAXSERVERS
+    
+    struct ubik_client:
+        pass
+
+cdef extern from "rx/rx.h":
+    int rx_Init(int port)
+
+cdef class PTS:
+    cdef ubik_client * client
+    
+    def __cinit__(self):
+        cdef afs_int32 code
+        
+        self.client = NULL
+        
+        code = rx_Init(0)
+        if code != 0:
+            raise Exception(str(code))
diff --git a/setup.py b/setup.py
new file mode 100755 (executable)
index 0000000..6dc758c
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+from setuptools import setup, find_packages
+from distutils.extension import Extension
+from Pyrex.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 = ['%s/include' % root]
+library_dirs = ['%s/lib' % root,
+                '%s/lib/afs' % root]
+
+setup(
+    name="PyAFS",
+    version="0.0.0",
+    description="PyAFS - Python bindings for AFS",
+    author="Evan Broder",
+    author_email="broder@mit.edu",
+    license="MIT",
+    requires=['Pyrex'],
+    packages=find_packages(),
+    ext_modules=[
+        Extension("afs._pts",
+                  ["afs/_pts.pyx"],
+                  libraries=['bos', 'volser', 'vldb', 'afsrpc', 'afsauthent',
+                             'cmd', 'usd', 'audit'],
+                  include_dirs=include_dirs,
+                  library_dirs=library_dirs)
+        ],
+    cmdclass= {"build_ext": build_ext}
+)