diff options
author | Justin Clift <justin@gluster.org> | 2014-03-21 13:18:29 +0000 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-03-24 10:31:55 -0700 |
commit | 446547559952e3b8af943f87c7475b80dd090153 (patch) | |
tree | b9a7541a39fae83df919bcebd954611fd5d66649 /xlators/features | |
parent | 853a90f9d7399e4afdb685946a809e9dd30a1b98 (diff) |
features/glupy: Rename Glupy python module to avoid namespace conflict
* Rename gluster.py to glupy.py to avoid namespace conflict (#1018619)
* Move the main Glupy files into glusterfs-extra-xlators rpm
* Move the Glupy Translator examples into glusterfs-devel rpm
Backport of: http://review.gluster.org/#/c/6979/
Change-Id: Ie9b71b56502f8e98c527ade381c918446bc7f022
BUG: 1018619
Signed-off-by: Justin Clift <justin@gluster.org>
Reviewed-on: http://review.gluster.org/7316
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/glupy/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/features/glupy/examples/Makefile.am | 5 | ||||
-rw-r--r-- | xlators/features/glupy/examples/debug-trace.py (renamed from xlators/features/glupy/src/debug-trace.py) | 11 | ||||
-rw-r--r-- | xlators/features/glupy/examples/helloworld.py (renamed from xlators/features/glupy/src/helloworld.py) | 2 | ||||
-rw-r--r-- | xlators/features/glupy/examples/negative.py (renamed from xlators/features/glupy/src/negative.py) | 3 | ||||
-rw-r--r-- | xlators/features/glupy/src/Makefile.am | 13 | ||||
-rw-r--r-- | xlators/features/glupy/src/glupy.c | 5 | ||||
-rw-r--r-- | xlators/features/glupy/src/glupy.py (renamed from xlators/features/glupy/src/gluster.py) | 0 | ||||
-rw-r--r-- | xlators/features/glupy/src/setup.py.in | 24 |
9 files changed, 48 insertions, 17 deletions
diff --git a/xlators/features/glupy/Makefile.am b/xlators/features/glupy/Makefile.am index a985f42a877..060429ecf0f 100644 --- a/xlators/features/glupy/Makefile.am +++ b/xlators/features/glupy/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = src +SUBDIRS = src examples CLEANFILES = diff --git a/xlators/features/glupy/examples/Makefile.am b/xlators/features/glupy/examples/Makefile.am new file mode 100644 index 00000000000..c26abeaafb6 --- /dev/null +++ b/xlators/features/glupy/examples/Makefile.am @@ -0,0 +1,5 @@ +xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features + +glupyexamplesdir = $(xlatordir)/glupy + +glupyexamples_PYTHON = negative.py helloworld.py debug-trace.py diff --git a/xlators/features/glupy/src/debug-trace.py b/xlators/features/glupy/examples/debug-trace.py index 53e76546b15..6eef1b58b8f 100644 --- a/xlators/features/glupy/src/debug-trace.py +++ b/xlators/features/glupy/examples/debug-trace.py @@ -2,12 +2,13 @@ import sys import stat from uuid import UUID from time import strftime, localtime -from gluster import * +from gluster.glupy import * + # This translator was written primarily to test the fop entry point definitions -# and structure definitions in 'gluster.py'. -# It is similar to the debug-trace translator, one of the already available -# translator types written in C, that logs the arguments passed to the fops and -# their corresponding cbk functions. +# and structure definitions in 'glupy.py'. + +# It is similar to the C language debug-trace translator, which logs the +# arguments passed to the fops and their corresponding cbk functions. dl.get_id.restype = c_long dl.get_id.argtypes = [ POINTER(call_frame_t) ] diff --git a/xlators/features/glupy/src/helloworld.py b/xlators/features/glupy/examples/helloworld.py index 8fe4037118e..b565a4e5bc3 100644 --- a/xlators/features/glupy/src/helloworld.py +++ b/xlators/features/glupy/examples/helloworld.py @@ -1,5 +1,5 @@ import sys -from gluster import * +from gluster.glupy import * class xlator (Translator): diff --git a/xlators/features/glupy/src/negative.py b/xlators/features/glupy/examples/negative.py index 1023602b9f3..e7a4fc07ced 100644 --- a/xlators/features/glupy/src/negative.py +++ b/xlators/features/glupy/examples/negative.py @@ -1,6 +1,6 @@ import sys from uuid import UUID -from gluster import * +from gluster.glupy import * # Negative-lookup-caching example. If a file wasn't there the last time we # looked, it's probably still not there. This translator keeps track of @@ -89,4 +89,3 @@ class xlator (Translator): dl.unwind_create(frame,cookie,this,op_ret,op_errno,fd,inode,buf, preparent,postparent,xdata) return 0 - diff --git a/xlators/features/glupy/src/Makefile.am b/xlators/features/glupy/src/Makefile.am index 9608628398f..9ba33a1f2c6 100644 --- a/xlators/features/glupy/src/Makefile.am +++ b/xlators/features/glupy/src/Makefile.am @@ -1,11 +1,12 @@ xlator_LTLIBRARIES = glupy.la +# Ensure GLUSTER_PYTHON_PATH is passed to glupy.so xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features - glupydir = $(xlatordir)/glupy +AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC) +AM_CFLAGS = -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS) -glupy_PYTHON = gluster.py negative.py helloworld.py debug-trace.py - +# Flags to build glupy.so with glupy_la_LDFLAGS = -module -avoid-version -shared -nostartfiles glupy_la_SOURCES = glupy.c glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ @@ -13,8 +14,8 @@ glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ noinst_HEADERS = glupy.h -AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC) - -AM_CFLAGS = -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS) +# Install glupy.py into the Python site-packages area +pyglupydir = $(pythondir)/gluster +pyglupy_PYTHON = glupy.py CLEANFILES = diff --git a/xlators/features/glupy/src/glupy.c b/xlators/features/glupy/src/glupy.c index dc86c0071e1..948b66f8d11 100644 --- a/xlators/features/glupy/src/glupy.c +++ b/xlators/features/glupy/src/glupy.c @@ -2365,7 +2365,7 @@ init (xlator_t *this) goto *err_cleanup; } - gf_log (this->name, GF_LOG_ERROR, "py_mod_name = %s", module_name); + gf_log (this->name, GF_LOG_DEBUG, "py_mod_name = %s", module_name); priv->py_module = PyImport_Import(py_mod_name); Py_DECREF(py_mod_name); if (!priv->py_module) { @@ -2375,6 +2375,7 @@ init (xlator_t *this) } goto *err_cleanup; } + gf_log (this->name, GF_LOG_INFO, "Import of %s succeeded", module_name); err_cleanup = &&err_deref_module; py_init_func = PyObject_GetAttrString(priv->py_module, "xlator"); @@ -2407,7 +2408,7 @@ init (xlator_t *this) } goto *err_cleanup; } - gf_log (this->name, GF_LOG_INFO, "init returned %p", priv->py_xlator); + gf_log (this->name, GF_LOG_DEBUG, "init returned %p", priv->py_xlator); return 0; diff --git a/xlators/features/glupy/src/gluster.py b/xlators/features/glupy/src/glupy.py index a5daa77d32a..a5daa77d32a 100644 --- a/xlators/features/glupy/src/gluster.py +++ b/xlators/features/glupy/src/glupy.py diff --git a/xlators/features/glupy/src/setup.py.in b/xlators/features/glupy/src/setup.py.in new file mode 100644 index 00000000000..1aea9875f0a --- /dev/null +++ b/xlators/features/glupy/src/setup.py.in @@ -0,0 +1,24 @@ +from distutils.core import setup + +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 Glupy, the Python translator interface for GlusterFS.""" + +setup( + name='glusterfs-glupy', + version='@PACKAGE_VERSION@', + description='Glupy is the Python translator interface for GlusterFS', + long_description=DESC, + author='Gluster Community', + author_email='gluster-devel@nongnu.org', + license='LGPLv3', + url='http://gluster.org/', + package_dir={'gluster':''}, + packages=['gluster'] +) |