From 2d2104b92ce4f472ade76c8fbb737b1c9028f8ea Mon Sep 17 00:00:00 2001
From: Evan Broder <broder@mit.edu>
Date: Sun, 21 Dec 2008 02:55:41 -0600
Subject: [PATCH] Initial commit of something that builds.

Signed-off-by: Evan Broder <broder@mit.edu>
---
 .gitignore   |    6 ++++++
 afs/_pts.pyx |   24 ++++++++++++++++++++++++
 setup.py     |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 afs/__init__.py
 create mode 100644 afs/_pts.pyx
 create mode 100755 setup.py

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..26041b4
--- /dev/null
+++ b/.gitignore
@@ -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
index 0000000..e69de29
diff --git a/afs/_pts.pyx b/afs/_pts.pyx
new file mode 100644
index 0000000..49ee9b6
--- /dev/null
+++ b/afs/_pts.pyx
@@ -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
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}
+)
-- 
1.7.9.5