From b235a56394c09bb1d7308a620053dbe098d15967 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 22 Feb 2019 15:17:48 +0100 Subject: build: include gluster/__init__.* files for python packaging The gluster/__init__.py file was originaly part of the glupy installation. This file is required to have the python-gluster package function correctly, it is expected to provide the 'gluster' namespace for other python packages (like from the libgfapi-python project). Because glupy does not exist anymore, this file is now added to in a new extras/python directory. Change-Id: I14fe959778ee3344d7d54ba342c7928a4d8080a2 Fixes: c3fcff9ccbfcec1be242fd5cf210c9995586b078 Fixes: 8293d21280fd6ddfc9bb54068cf87794fc6be207 Updates: bz#1642810 Signed-off-by: Niels de Vos --- configure.ac | 2 ++ extras/Makefile.am | 2 +- extras/python/Makefile.am | 7 +++++++ extras/python/__init__.py | 2 ++ glusterfs.spec.in | 3 +++ 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 extras/python/Makefile.am create mode 100644 extras/python/__init__.py diff --git a/configure.ac b/configure.ac index 3aa7f4e77c..e055e8c8f0 100644 --- a/configure.ac +++ b/configure.ac @@ -226,6 +226,7 @@ AC_CONFIG_FILES([Makefile extras/hook-scripts/reset/Makefile extras/hook-scripts/reset/post/Makefile extras/hook-scripts/reset/pre/Makefile + extras/python/Makefile extras/snap_scheduler/Makefile events/Makefile events/src/Makefile @@ -630,6 +631,7 @@ AM_PATH_PYTHON([2.6],,[:]) if test -n "${PYTHON}"; then have_python=yes fi +AM_CONDITIONAL(HAVE_PYTHON, test "x$have_python" = "xyes") dnl Use pkg-config to get runtime search path missing from ${PYTHON}-config dnl Just do "true" on failure so that configure does not bail out diff --git a/extras/Makefile.am b/extras/Makefile.am index cf4e9264be..de062f37ec 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -11,7 +11,7 @@ EditorModedir = $(docdir) EditorMode_DATA = glusterfs-mode.el glusterfs.vim SUBDIRS = init.d systemd benchmarking hook-scripts $(OCF_SUBDIR) LinuxRPM \ - $(GEOREP_EXTRAS_SUBDIR) snap_scheduler firewalld cliutils + $(GEOREP_EXTRAS_SUBDIR) snap_scheduler firewalld cliutils python confdir = $(sysconfdir)/glusterfs if WITH_SERVER diff --git a/extras/python/Makefile.am b/extras/python/Makefile.am new file mode 100644 index 0000000000..7d81fa0319 --- /dev/null +++ b/extras/python/Makefile.am @@ -0,0 +1,7 @@ +if HAVE_PYTHON +# Install __init__.py into the Python site-packages area +pypkgdir = @BUILD_PYTHON_SITE_PACKAGES@/gluster +pypkg_PYTHON = __init__.py +endif + +EXTRA_DIST = __init__.py diff --git a/extras/python/__init__.py b/extras/python/__init__.py new file mode 100644 index 0000000000..3ad9513f40 --- /dev/null +++ b/extras/python/__init__.py @@ -0,0 +1,2 @@ +from pkgutil import extend_path +__path__ = extend_path(__path__, __name__) diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 45b671e33f..205b51d4bb 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -1186,9 +1186,12 @@ exit 0 # so that all other gluster submodules can reside in the same namespace. %if ( %{_usepython3} ) %dir %{python3_sitelib}/gluster + %{python3_sitelib}/gluster/__init__.* + %{python3_sitelib}/gluster/__pycache__ %{python3_sitelib}/gluster/cliutils %else %dir %{python2_sitelib}/gluster + %{python2_sitelib}/gluster/__init__.* %{python2_sitelib}/gluster/cliutils %endif -- cgit