summaryrefslogtreecommitdiffstats
path: root/api/examples
diff options
context:
space:
mode:
Diffstat (limited to 'api/examples')
-rw-r--r--api/examples/Makefile.am6
-rwxr-xr-xapi/examples/gfapi.py19
-rw-r--r--api/examples/setup.py.in29
3 files changed, 44 insertions, 10 deletions
diff --git a/api/examples/Makefile.am b/api/examples/Makefile.am
index 6048bb1c8b7..cfb0d3dff84 100644
--- a/api/examples/Makefile.am
+++ b/api/examples/Makefile.am
@@ -1,4 +1,6 @@
-noinst_PROGRAMS = glfsxmp
+EXTRA_PROGRAMS = glfsxmp
glfsxmp_SOURCES = glfsxmp.c
glfsxmp_CFLAGS = $(GLFS_CFLAGS) -Wall
-glfsxmp_LDADD = $(GLFS_LIBS) \ No newline at end of file
+glfsxmp_LDADD = $(GLFS_LIBS)
+
+EXTRA_DIST = gfapi.py
diff --git a/api/examples/gfapi.py b/api/examples/gfapi.py
index 8d9ed732947..3ac67f4d5ba 100755
--- a/api/examples/gfapi.py
+++ b/api/examples/gfapi.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
from ctypes import *
+from ctypes.util import find_library
import os
import sys
import time
@@ -8,9 +9,9 @@ import types
# Looks like ctypes is having trouble with dependencies, so just force them to
# load with RTLD_GLOBAL until I figure that out.
-glfs = CDLL("libglusterfs.so",RTLD_GLOBAL)
-xdr = CDLL("libgfxdr.so",RTLD_GLOBAL)
-api = CDLL("libgfapi.so",RTLD_GLOBAL)
+glfs = CDLL(find_library("glusterfs"),RTLD_GLOBAL)
+xdr = CDLL(find_library("gfxdr"),RTLD_GLOBAL)
+api = CDLL(find_library("gfapi"),RTLD_GLOBAL)
# Wow, the Linux kernel folks really play nasty games with this structure. If
# you look at the man page for stat(2) and then at this definition you'll note
@@ -98,10 +99,12 @@ class File(object):
def write (self, data, flags=0):
return api.glfs_write(self.fd,data,len(data),flags)
- def fallocate (self, mode, offset, len):
- return api.glfs_fallocate(self.fd, mode, offset, len)
- def discard (self, offset, len):
- return api.glfs_discard(self.fd, offset, len)
+ def fallocate (self, mode, offset, len):
+ return api.glfs_fallocate(self.fd, mode, offset, len)
+
+ def discard (self, offset, len):
+ return api.glfs_discard(self.fd, offset, len)
+
class Dir(object):
@@ -381,7 +384,7 @@ if __name__ == "__main__":
test_setxattr,
test_getxattr,
test_listxattr,
- test_fallocate,
+ test_fallocate,
)
ok_to_fail = (
diff --git a/api/examples/setup.py.in b/api/examples/setup.py.in
new file mode 100644
index 00000000000..44b73809486
--- /dev/null
+++ b/api/examples/setup.py.in
@@ -0,0 +1,29 @@
+from distutils.core import setup
+
+# generate a __init__.py for the package namespace
+fo = open('__init__.py', 'w')
+fo.write('__version__ = "@PACKAGE_VERSION@"\n')
+fo.close()
+
+DESC = """GlusterFS is a clustered file-system capable of scaling to
+several petabytes. It aggregates various storage bricks over Infiniband
+RDMA or TCP/IP interconnect into one large parallel network file system.
+GlusterFS is one of the most sophisticated file systems in terms of
+features and extensibility. It borrows a powerful concept called
+Translators from GNU Hurd kernel. Much of the code in GlusterFS is in
+user space and easily manageable.
+
+This package contains the Python interface to the libgfapi library."""
+
+setup(
+ name='glusterfs-api',
+ version='@PACKAGE_VERSION@',
+ description='Python client library for the GlusterFS libgfapi',
+ long_description=DESC,
+ author='Gluster Community',
+ author_email='gluster-devel@nongnu.org',
+ license='LGPLv3',
+ url='http://gluster.org/',
+ package_dir={'gluster':''},
+ packages=['gluster']
+)