From 7f4b67d7f215fd22223ced8526783cd45f7b0e29 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sun, 21 Dec 2008 03:15:23 -0600 Subject: [PATCH 1/1] Pull includes into a common file, since there will be a bunch of them. Signed-off-by: Evan Broder --- .gitignore | 2 ++ afs/_pts.pyx | 19 ++++--------------- afs/afs.pxd | 12 ++++++++++++ setup.py | 3 ++- 4 files changed, 20 insertions(+), 16 deletions(-) create mode 100644 afs/afs.pxd diff --git a/.gitignore b/.gitignore index 26041b4..e5dd526 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ afs/_pts.c +afs/_pts.dep + *.so build dist diff --git a/afs/_pts.pyx b/afs/_pts.pyx index 49ee9b6..6678418 100644 --- a/afs/_pts.pyx +++ b/afs/_pts.pyx @@ -1,24 +1,13 @@ -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) +cimport afs as a cdef class PTS: - cdef ubik_client * client + cdef a.ubik_client * client def __cinit__(self): - cdef afs_int32 code + cdef a.afs_int32 code self.client = NULL - code = rx_Init(0) + code = a.rx_Init(0) if code != 0: raise Exception(str(code)) diff --git a/afs/afs.pxd b/afs/afs.pxd new file mode 100644 index 0000000..5fb03e7 --- /dev/null +++ b/afs/afs.pxd @@ -0,0 +1,12 @@ +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) diff --git a/setup.py b/setup.py index 6dc758c..1e7b770 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,8 @@ for root in ['/Library/OpenAFS/Tools', if os.path.exists('%s/include/afs/afs.h' % root): break -include_dirs = ['%s/include' % root] +include_dirs = [os.path.join(os.path.dirname(__file__), 'afs'), + '%s/include' % root] library_dirs = ['%s/lib' % root, '%s/lib/afs' % root] -- 1.7.9.5