summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rwxr-xr-xapi/examples/getvolfile.py2
-rw-r--r--configure.ac105
-rw-r--r--events/eventskeygen.py2
-rw-r--r--events/src/gf_event.py2
-rw-r--r--events/src/glustereventsd.py2
-rw-r--r--events/src/peer_eventsapi.py2
-rw-r--r--events/tools/eventsdash.py2
-rw-r--r--extras/cliutils/README.md4
-rwxr-xr-xextras/create_new_xlator/generate_xlator.py2
-rwxr-xr-xextras/distributed-testing/distributed-test-runner.py2
-rwxr-xr-xextras/failed-tests.py2
-rw-r--r--extras/geo-rep/schedule_georep.py.in2
-rwxr-xr-xextras/hook-scripts/S40ufo-stop.py2
-rwxr-xr-xextras/profiler/glusterfs-profiler2
-rwxr-xr-xextras/quota/xattr_analysis.py2
-rwxr-xr-xextras/rebalance.py2
-rw-r--r--extras/snap_scheduler/conf.py.in2
-rwxr-xr-xextras/snap_scheduler/gcron.py2
-rwxr-xr-xextras/snap_scheduler/snap_scheduler.py2
-rw-r--r--geo-replication/src/peer_georep-sshkey.py.in2
-rw-r--r--geo-replication/src/peer_mountbroker.in2
-rw-r--r--geo-replication/src/peer_mountbroker.py.in2
-rw-r--r--geo-replication/syncdaemon/changelogagent.py2
-rw-r--r--geo-replication/syncdaemon/conf.py.in2
-rw-r--r--geo-replication/syncdaemon/gsyncd.py2
-rw-r--r--geo-replication/syncdaemon/gsyncdstatus.py2
-rw-r--r--geo-replication/tests/__init__.py2
-rw-r--r--geo-replication/tests/unit/__init__.py2
-rw-r--r--geo-replication/tests/unit/test_gsyncdstatus.py2
-rw-r--r--geo-replication/tests/unit/test_syncdutils.py2
-rw-r--r--glusterfs.spec.in103
-rw-r--r--libglusterfs/src/gen-defaults.py2
-rwxr-xr-xlibglusterfs/src/generator.py2
-rwxr-xr-xtests/bugs/distribute/overlap.py2
-rwxr-xr-xtests/bugs/nfs/socket-as-fifo.py2
-rwxr-xr-xtests/features/ipctest.py2
-rwxr-xr-xtests/utils/create-files.py2
-rwxr-xr-xtests/utils/getfattr.py2
-rwxr-xr-xtests/utils/gfid-access.py2
-rwxr-xr-xtests/utils/pidof.py2
-rwxr-xr-xtests/utils/setfattr.py2
-rw-r--r--tools/gfind_missing_files/gfid_to_path.py2
-rwxr-xr-xtools/glusterfind/S57glusterfind-delete-post.py2
-rw-r--r--tools/glusterfind/glusterfind.in2
-rw-r--r--tools/glusterfind/src/brickfind.py2
-rw-r--r--tools/glusterfind/src/changelog.py2
-rw-r--r--tools/glusterfind/src/main.py2
-rw-r--r--tools/glusterfind/src/nodeagent.py2
-rwxr-xr-xxlators/experimental/fdl/src/gen_dumper.py2
-rwxr-xr-xxlators/experimental/fdl/src/gen_fdl.py2
-rwxr-xr-xxlators/experimental/fdl/src/gen_recon.py2
-rwxr-xr-xxlators/experimental/jbr-client/src/gen-fops.py2
-rwxr-xr-xxlators/experimental/jbr-server/src/gen-fops.py2
-rw-r--r--xlators/features/changelog/lib/examples/python/changes.py2
-rw-r--r--xlators/features/glupy/src/Makefile.am15
-rw-r--r--xlators/features/glupy/src/__init__.py.in2
57 files changed, 178 insertions, 156 deletions
diff --git a/Makefile.am b/Makefile.am
index f5af4220647..274f71030c0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,8 @@ EXTRA_DIST = autogen.sh \
glusterfs.spec glusterfs-api.pc.in libgfchangelog.pc.in libgfdb.pc.in \
run-tests.sh \
build-aux/pkg-version \
- contrib/umountd \
+ contrib/umountd \
+ python-shebangs \
$(shell find $(top_srcdir)/tests -type f -print)
SUBDIRS = $(ARGP_STANDALONE_DIR) rpc/xdr/gen libglusterfs rpc api xlators \
diff --git a/api/examples/getvolfile.py b/api/examples/getvolfile.py
index 9a5dd0d290a..3b2c8ab5a15 100755
--- a/api/examples/getvolfile.py
+++ b/api/examples/getvolfile.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import ctypes
diff --git a/configure.ac b/configure.ac
index 4db28ef1c11..9fa45190f59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -635,53 +635,55 @@ fi
dnl Check Python Availability
have_python=no
-case $host_os in
- freebsd*)
- PYTHON=/usr/local/bin/python2
- ;;
- *)
- PYTHON=/usr/bin/python2
- ;;
-esac
+dnl if the user has not specified a python, pick one
+if test -z "${PYTHON}"; then
+ case $host_os in
+ freebsd*)
+ if test -x /usr/local/bin/python3; then
+ PYTHON=/usr/local/bin/python3
+ else
+ PYTHON=/usr/local/bin/python2
+ fi
+ ;;
+ *)
+ if test -x /usr/bin/python3; then
+ PYTHON=/usr/bin/python3
+ else
+ PYTHON=/usr/bin/python2
+ fi
+ ;;
+ esac
+fi
AM_PATH_PYTHON([2.6],,[:])
-if test "x${PYTHON}" != "x:"; then
+if test -n "${PYTHON}"; then
have_python=yes
fi
-echo "python = ${PYTHON}"
-
-dnl Check if version matches that we require
-PYTHONDEV_CPPFLAGS=
-PYTHONDEV_LDFLAGS=
-BUILD_PYTHON_SITE_PACKAGES=
-BUILD_PYTHON_INC=
-BUILD_PYTHON_LIB=
-have_Python_h="no"
+echo "PYTHON = ${PYTHON} ${PYTHON_VERSION}"
-dnl Use pkg-config to get runtime search patch missing from ${PYTHON}-config
+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
-PKG_CHECK_MODULES([PYTHON], "python-${PYTHON_VERSION}",,true)
-
-PYTHONDEV_CPPFLAGS="`${PYTHON}-config --cflags`"
-dnl Edit out the flags that are not required or are conflicting
-PYTHONDEV_CPPFLAGS=`echo ${PYTHONDEV_CPPFLAGS} | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[[0-9]]//g'`
+dnl Note: python 2.6's devel pkg (e.g. in CentOS/RHEL 6) does not have
+dnl pkg-config files, so this work-around instead
+if test "x${PYTHON_VERSION}" = "x2.6"; then
+ PYTHON_CFLAGS=$(python-config --includes)
+ PYTHON_LIBS=$(python-config --libs)
+else
+ PKG_CHECK_MODULES([PYTHON], "python-${PYTHON_VERSION}",,true)
+fi
-dnl Find python libs at user configured libdir and also "lib" under prefix
-PYTHONDEV_LDFLAGS="${PYTHON_LIBS} -L`${PYTHON}-config --prefix`/lib -L`${PYTHON}-config --prefix`/$libdir `${PYTHON}-config --ldflags`"
+PYTHON_CFLAGS=$(echo ${PYTHON_CFLAGS} | sed -e 's|-I|-isystem |')
BUILD_PYTHON_SITE_PACKAGES=${pythondir}
-BUILD_PYTHON_INC=`${PYTHON} -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_inc())" 2>/dev/null`
-BUILD_PYTHON_LIB=python${PYTHON_VERSION}
-
-dnl Now check for python header using the include path obtained above
-AC_CHECK_HEADERS([${BUILD_PYTHON_INC}/Python.h],[have_Python_h=yes],[])
-
-AC_SUBST(PYTHONDEV_CPPFLAGS)
-AC_SUBST(PYTHONDEV_LDFLAGS)
AC_SUBST(BUILD_PYTHON_SITE_PACKAGES)
-AC_SUBST(BUILD_PYTHON_INC)
-AC_SUBST(BUILD_PYTHON_LIB)
+# Eval two times to expand fully. First eval replaces $exec_prefix into $prefix
+# Second eval will expand $prefix
+build_python_site_packages_temp="${pythondir}"
+eval build_python_site_packages_temp=\"${build_python_site_packages_temp}\"
+eval build_python_site_packages_temp=\"${build_python_site_packages_temp}\"
+BUILD_PYTHON_SITE_PACKAGES_EXPANDED=${build_python_site_packages_temp}
+AC_SUBST(BUILD_PYTHON_SITE_PACKAGES_EXPANDED)
# FUSE section
AC_ARG_ENABLE([fuse-client],
@@ -1002,7 +1004,7 @@ fi
dnl cloudsync section
BUILD_CLOUDSYNC="no"
AC_CHECK_LIB([curl], [curl_easy_setopt], [LIBCURL="-lcurl"])
-if test "x$LIBCURL" != "x";then
+if test -n "$LIBCURL";then
HAVE_LIBCURL="yes"
fi
AC_CHECK_HEADERS([openssl/hmac.h openssl/evp.h openssl/bio.h openssl/buffer.h], [HAVE_OPENSSL="yes"])
@@ -1369,19 +1371,11 @@ sysconfdirtemp="${sysconfdir}"
eval sysconfdirtemp=\"${sysconfdirtemp}\"
SYSCONF_DIR=${sysconfdirtemp}
-# Eval two times to expand fully. First eval replaces $exec_prefix into $prefix
-# Second eval will expand $prefix
-build_python_site_packages_temp="${BUILD_PYTHON_SITE_PACKAGES}"
-eval build_python_site_packages_temp=\"${build_python_site_packages_temp}\"
-eval build_python_site_packages_temp=\"${build_python_site_packages_temp}\"
-BUILD_PYTHON_SITE_PACKAGES_EXPANDED=${build_python_site_packages_temp}
-
prefix=$prefix_temp
exec_prefix=$exec_prefix_temp
AC_SUBST(SBIN_DIR)
AC_SUBST(SYSCONF_DIR)
-AC_SUBST(BUILD_PYTHON_SITE_PACKAGES_EXPANDED)
# lazy umount emulation
UMOUNTD_SUBDIR=""
@@ -1425,7 +1419,7 @@ AC_CHECK_LIB([readline -lcurses],[readline],[RLLIBS="-lreadline -lcurses"])
AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"])
AC_CHECK_LIB([readline -lncurses],[readline],[RLLIBS="-lreadline -lncurses"])
-if test "x$RLLIBS" != "x"; then
+if test -n "$RLLIBS"; then
if test "x$RL_UNDO" = "xyes"; then
AC_DEFINE(HAVE_READLINE, 1, [readline enabled CLI])
BUILD_READLINE=yes
@@ -1438,7 +1432,7 @@ fi
BUILD_LIBAIO=no
AC_CHECK_LIB([aio],[io_setup],[LIBAIO="-laio"])
-if test "x$LIBAIO" != "x"; then
+if test -n "$LIBAIO"; then
AC_DEFINE(HAVE_LIBAIO, 1, [libaio based POSIX enabled])
BUILD_LIBAIO=yes
fi
@@ -1454,7 +1448,7 @@ if test "x$enable_glupy" = "xyes"; then
GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
- if test "x${have_python}" = "xyes" -a "x${have_Python_h}" = "xyes"; then
+ if test "x${have_python}" = "xyes" -a -n "${PYTHON_CFLAGS}"; then
case $host_os in
darwin*)
BUILD_GLUPY=no
@@ -1472,7 +1466,7 @@ if test "x$enable_glupy" = "xyes"; then
if test "x$BUILD_GLUPY" = "xyes"; then
- echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
+ echo "building glupy with -isystem ${PYTHON_CFLAGS} ${PYTHON_LIBS}"
AC_SUBST(GLUPY_SUBDIR)
AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
@@ -1723,6 +1717,19 @@ AC_SUBST(GFAPI_EXTRA_LDFLAGS)
GFAPI_LIBS="${ACL_LIBS}"
AC_SUBST(GFAPI_LIBS)
+pushd $(dirname $0)
+if test ! -e python-shebangs; then
+ touch python-shebangs
+ if test "x${PYTHON}" = "x/usr/bin/python2"; then
+ echo "fixing python shebangs..."
+ for f in api events extras geo-replication libglusterfs tests tools xlators; do
+ find $f -type f -exec sed -i 's|/usr/bin/python3|/usr/bin/python2|' {} \;
+ done
+ echo "...done"
+ fi
+fi
+popd
+
dnl this change necessary for run-tests.sh
AC_CONFIG_FILES([tests/env.rc],[ln -s ${ac_abs_builddir}/env.rc ${ac_abs_srcdir}/env.rc 2>/dev/null])
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
index 4ccedea8f9e..e28ebe9b7e6 100644
--- a/events/eventskeygen.py
+++ b/events/eventskeygen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
diff --git a/events/src/gf_event.py b/events/src/gf_event.py
index fd272434242..1454063c863 100644
--- a/events/src/gf_event.py
+++ b/events/src/gf_event.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
diff --git a/events/src/glustereventsd.py b/events/src/glustereventsd.py
index b61d1a1b28b..324695ecea3 100644
--- a/events/src/glustereventsd.py
+++ b/events/src/glustereventsd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
diff --git a/events/src/peer_eventsapi.py b/events/src/peer_eventsapi.py
index fb11e12deb4..fbfb1d66bb2 100644
--- a/events/src/peer_eventsapi.py
+++ b/events/src/peer_eventsapi.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
diff --git a/events/tools/eventsdash.py b/events/tools/eventsdash.py
index 4346c834ee4..6479ea59da6 100644
--- a/events/tools/eventsdash.py
+++ b/events/tools/eventsdash.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
diff --git a/extras/cliutils/README.md b/extras/cliutils/README.md
index 2e0ffe772c7..e11166774e3 100644
--- a/extras/cliutils/README.md
+++ b/extras/cliutils/README.md
@@ -81,7 +81,7 @@ to address the following issues
Create a file in `$LIBEXEC/glusterfs/peer_message.py` with following
content.
- #!/usr/bin/python2
+ #!/usr/bin/python3
from gluster.cliutils import Cmd, runcli, execute_in_peers, node_output_ok
class NodeHello(Cmd):
@@ -149,7 +149,7 @@ Now users can use `gluster-message` instead of calling
Following example uses prettytable library, which can be installed
using `pip install prettytable` or `dnf install python-prettytable`
- #!/usr/bin/python2
+ #!/usr/bin/python3
from prettytable import PrettyTable
from gluster.cliutils import Cmd, runcli, execute_in_peers, node_output_ok
diff --git a/extras/create_new_xlator/generate_xlator.py b/extras/create_new_xlator/generate_xlator.py
index 2746e90893d..2c554c991c9 100755
--- a/extras/create_new_xlator/generate_xlator.py
+++ b/extras/create_new_xlator/generate_xlator.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import os
diff --git a/extras/distributed-testing/distributed-test-runner.py b/extras/distributed-testing/distributed-test-runner.py
index 4d6313625db..7bfb6c9652a 100755
--- a/extras/distributed-testing/distributed-test-runner.py
+++ b/extras/distributed-testing/distributed-test-runner.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
diff --git a/extras/failed-tests.py b/extras/failed-tests.py
index 0f5ad38aa09..f7f110246b5 100755
--- a/extras/failed-tests.py
+++ b/extras/failed-tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import blessings
diff --git a/extras/geo-rep/schedule_georep.py.in b/extras/geo-rep/schedule_georep.py.in
index 38d8f500ad6..79af80b841a 100644
--- a/extras/geo-rep/schedule_georep.py.in
+++ b/extras/geo-rep/schedule_georep.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
"""
Schedule Geo-replication
------------------------
diff --git a/extras/hook-scripts/S40ufo-stop.py b/extras/hook-scripts/S40ufo-stop.py
index 48ee1c788b6..2c79eb1d54a 100755
--- a/extras/hook-scripts/S40ufo-stop.py
+++ b/extras/hook-scripts/S40ufo-stop.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
import os
from optparse import OptionParser
diff --git a/extras/profiler/glusterfs-profiler b/extras/profiler/glusterfs-profiler
index 5f5e4ed8dbd..aaafd088648 100755
--- a/extras/profiler/glusterfs-profiler
+++ b/extras/profiler/glusterfs-profiler
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/extras/quota/xattr_analysis.py b/extras/quota/xattr_analysis.py
index 780ff340677..7bd7d96374c 100755
--- a/extras/quota/xattr_analysis.py
+++ b/extras/quota/xattr_analysis.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Below script has two purposes
# 1. Display xattr of entire FS tree in a human readable form
# 2. Display all the directory where contri and size mismatch.
diff --git a/extras/rebalance.py b/extras/rebalance.py
index 6dd364b9028..59d7af96d88 100755
--- a/extras/rebalance.py
+++ b/extras/rebalance.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import atexit
diff --git a/extras/snap_scheduler/conf.py.in b/extras/snap_scheduler/conf.py.in
index e04b6cb008b..35838005fc2 100644
--- a/extras/snap_scheduler/conf.py.in
+++ b/extras/snap_scheduler/conf.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py
index de79562ceab..1c8569dcd85 100755
--- a/extras/snap_scheduler/gcron.py
+++ b/extras/snap_scheduler/gcron.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py
index f0868d8b57d..09859844efc 100755
--- a/extras/snap_scheduler/snap_scheduler.py
+++ b/extras/snap_scheduler/snap_scheduler.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/geo-replication/src/peer_georep-sshkey.py.in b/geo-replication/src/peer_georep-sshkey.py.in
index c35865db224..2196fd7491a 100644
--- a/geo-replication/src/peer_georep-sshkey.py.in
+++ b/geo-replication/src/peer_georep-sshkey.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
diff --git a/geo-replication/src/peer_mountbroker.in b/geo-replication/src/peer_mountbroker.in
index 5d19db88b80..8ecf38ded41 100644
--- a/geo-replication/src/peer_mountbroker.in
+++ b/geo-replication/src/peer_mountbroker.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
diff --git a/geo-replication/src/peer_mountbroker.py.in b/geo-replication/src/peer_mountbroker.py.in
index d101de561e4..83d385cb5eb 100644
--- a/geo-replication/src/peer_mountbroker.py.in
+++ b/geo-replication/src/peer_mountbroker.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
diff --git a/geo-replication/syncdaemon/changelogagent.py b/geo-replication/syncdaemon/changelogagent.py
index 5eade137d25..c5fdbc3a74f 100644
--- a/geo-replication/syncdaemon/changelogagent.py
+++ b/geo-replication/syncdaemon/changelogagent.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2011-2014 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/geo-replication/syncdaemon/conf.py.in b/geo-replication/syncdaemon/conf.py.in
index 5846b9b5f26..82bbb69bc58 100644
--- a/geo-replication/syncdaemon/conf.py.in
+++ b/geo-replication/syncdaemon/conf.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py
index 77fca4c9d1f..a7ee5553deb 100644
--- a/geo-replication/syncdaemon/gsyncd.py
+++ b/geo-replication/syncdaemon/gsyncd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
diff --git a/geo-replication/syncdaemon/gsyncdstatus.py b/geo-replication/syncdaemon/gsyncdstatus.py
index 87fa09c070c..72bcb092f01 100644
--- a/geo-replication/syncdaemon/gsyncdstatus.py
+++ b/geo-replication/syncdaemon/gsyncdstatus.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2011-2014 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/geo-replication/tests/__init__.py b/geo-replication/tests/__init__.py
index 13065ca3d3c..31ab58b18b2 100644
--- a/geo-replication/tests/__init__.py
+++ b/geo-replication/tests/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2011-2014 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/geo-replication/tests/unit/__init__.py b/geo-replication/tests/unit/__init__.py
index 13065ca3d3c..31ab58b18b2 100644
--- a/geo-replication/tests/unit/__init__.py
+++ b/geo-replication/tests/unit/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2011-2014 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/geo-replication/tests/unit/test_gsyncdstatus.py b/geo-replication/tests/unit/test_gsyncdstatus.py
index b4ce8fa053b..483023dbfe9 100644
--- a/geo-replication/tests/unit/test_gsyncdstatus.py
+++ b/geo-replication/tests/unit/test_gsyncdstatus.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2011-2014 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/geo-replication/tests/unit/test_syncdutils.py b/geo-replication/tests/unit/test_syncdutils.py
index fe439a50b38..f01015241fd 100644
--- a/geo-replication/tests/unit/test_syncdutils.py
+++ b/geo-replication/tests/unit/test_syncdutils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2011-2014 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 8acc387b6b4..e2490f95eca 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -151,6 +151,14 @@
%global _without_ocf --without-ocf
%endif
+%if ( 0%{?fedora} && 0%{?fedora} > 26 ) || ( 0%{?rhel} && 0%{?rhel} > 7 )
+%global _usepython3 1
+%global _pythonver 3
+%else
+%global _usepython3 0
+%global _pythonver 2
+%endif
+
# From https://fedoraproject.org/wiki/Packaging:Python#Macros
%if ( 0%{?rhel} && 0%{?rhel} <= 6 )
%{!?python2_sitelib: %global python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
@@ -243,9 +251,6 @@ Source0: @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires(pre): shadow-utils
-%if ( 0%{?rhel} && 0%{?rhel} <= 5 )
-BuildRequires: python-simplejson
-%endif
%if ( 0%{?_with_systemd:1} )
BuildRequires: systemd
%endif
@@ -259,8 +264,8 @@ BuildRequires: gcc make libtool
BuildRequires: ncurses-devel readline-devel
BuildRequires: libxml2-devel openssl-devel
BuildRequires: libaio-devel libacl-devel
-BuildRequires: python2-devel
-%if ( 0%{?fedora} && 0%{?fedora} < 26 ) || ( 0%{?rhel} && 0%{?rhel} <= 7 )
+BuildRequires: python%{_pythonver}-devel
+%if ( 0%{?rhel} && 0%{?rhel} < 8 )
BuildRequires: python-ctypes
%endif
%if ( 0%{?_with_ipv6default:1} ) || ( 0%{!?_without_libtirpc:1} )
@@ -392,8 +397,8 @@ Summary: Extra Gluster filesystem Translators
Group: Applications/File
# We need python-gluster rpm for gluster module's __init__.py in Python
# site-packages area
-Requires: python2-gluster = %{version}-%{release}
-Requires: python2
+Requires: python%{_pythonver}-gluster = %{version}-%{release}
+Requires: python%{_pythonver}
%description extra-xlators
GlusterFS is a distributed file-system capable of scaling to several
@@ -453,9 +458,10 @@ Summary: GlusterFS Geo-replication
Group: Applications/File
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-server%{?_isa} = %{version}-%{release}
-Requires: python2
-Requires: python-prettytable
-Requires: python2-gluster = %{version}-%{release}
+Requires: python%{_pythonver}
+Requires: python%{_pythonver}-prettytable
+Requires: python%{_pythonver}-gluster = %{version}-%{release}
+
Requires: rsync
Requires: util-linux
@@ -506,37 +512,27 @@ is in user space and easily manageable.
This package provides the base GlusterFS libraries
-%package -n python-gluster
-Summary: GlusterFS python library
-Group: Development/Tools
-%if ( ! ( 0%{?rhel} && 0%{?rhel} < 6 || 0%{?sles_version} ) )
-# EL5 does not support noarch sub-packages
-BuildArch: noarch
-%endif
-
-%global _python_gluster_description \
-GlusterFS is a distributed 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 modules of GlusterFS and own gluster\
-namespace.
-
-%description -n python-gluster %{_python_gluster_description}
-
-%package -n python2-gluster
+%package -n python%{_pythonver}-gluster
Summary: GlusterFS python library
Group: Development/Tools
-%{?python_provide:%python_provide python2-gluster}
-Requires: python2
+Requires: python%{_pythonver}
+%if ( ! %{_usepython3} )
+%{?python_provide:%python_provide python-gluster}
Provides: python-gluster = %{version}-%{release}
Obsoletes: python-gluster < 3.10
+%endif
-%description -n python2-gluster %{_python_gluster_description}
+%description -n python%{_pythonver}-gluster
+GlusterFS is a distributed 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 modules of GlusterFS and own gluster
+namespace.
%if ( 0%{!?_without_rdma:1} )
%package rdma
@@ -571,7 +567,8 @@ Requires: %{name}-server%{?_isa} = %{version}-%{release}
## thin provisioning support
Requires: lvm2 >= 2.02.89
Requires: perl(App::Prove) perl(Test::Harness) gcc util-linux-ng
-Requires: python2 attr dbench file git libacl-devel net-tools
+Requires: python%{_pythonver}
+Requires: attr dbench file git libacl-devel net-tools
Requires: nfs-utils xfsprogs yajl psmisc bc
%description regression-tests
@@ -652,8 +649,8 @@ Obsoletes: %{name}-geo-replication = %{version}-%{release}
%if ( 0%{?rhel} && 0%{?rhel} <= 6 )
Requires: python-argparse
%endif
-%if ( 0%{?fedora} && 0%{?fedora} >= 28 )
-Requires: python2-pyxattr
+%if ( 0%{?fedora} && 0%{?fedora} > 27 ) || ( 0%{?rhel} && 0%{?rhel} > 7 )
+Requires: python%{_pythonver}-pyxattr
%else
Requires: pyxattr
%endif
@@ -693,12 +690,12 @@ This package provides the translators needed on any GlusterFS client.
Summary: GlusterFS Events
Group: Applications/File
Requires: %{name}-server%{?_isa} = %{version}-%{release}
-Requires: python2 python-prettytable
-Requires: python2-gluster = %{version}-%{release}
-%if ( 0%{?rhel} )
+Requires: python%{_pythonver} python%{_pythonver}-prettytable
+Requires: python%{_pythonver}-gluster = %{version}-%{release}
+%if ( 0%{?rhel} && 0%{?rhel} < 8 )
Requires: python-requests
%else
-Requires: python2-requests
+Requires: python%{_pythonver}-requests
%endif
%if ( 0%{?rhel} && 0%{?rhel} < 7 )
Requires: python-argparse
@@ -1185,6 +1182,10 @@ exit 0
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13.so
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy.so
+%if ( %{_usepython3} )
+%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/__pycache__
+ %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/__pycache__/*
+%endif
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quiesce.so
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/playground
@@ -1192,9 +1193,17 @@ exit 0
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/performance
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/performance/symlink-cache.so
# Glupy Python files
+%if ( %{_usepython3} )
+%dir %{python3_sitelib}/gluster
+%dir %{python3_sitelib}/gluster/__pycache__
+ %{python3_sitelib}/gluster/__pycache__/*
+%dir %{python3_sitelib}/gluster/glupy
+ %{python3_sitelib}/gluster/glupy/*
+%else
%dir %{python2_sitelib}/gluster
%dir %{python2_sitelib}/gluster/glupy
%{python2_sitelib}/gluster/glupy/*
+%endif
%files fuse
# glusterfs is a symlink to glusterfsd, -server depends on -fuse.
@@ -1274,12 +1283,18 @@ exit 0
%exclude %{_libdir}/libgfdb.*
%endif
-%files -n python2-gluster
+%files -n python%{_pythonver}-gluster
# introducing glusterfs module in site packages.
# 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/cliutils
+%else
%dir %{python2_sitelib}/gluster
%{python2_sitelib}/gluster/__init__.*
%{python2_sitelib}/gluster/cliutils
+%endif
%if ( 0%{!?_without_rdma:1} )
%files rdma
diff --git a/libglusterfs/src/gen-defaults.py b/libglusterfs/src/gen-defaults.py
index 0c96fd0c176..e31d3a9fe8a 100644
--- a/libglusterfs/src/gen-defaults.py
+++ b/libglusterfs/src/gen-defaults.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import sys
diff --git a/libglusterfs/src/generator.py b/libglusterfs/src/generator.py
index 64db4e8c479..c17d450502d 100755
--- a/libglusterfs/src/generator.py
+++ b/libglusterfs/src/generator.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
import string
diff --git a/tests/bugs/distribute/overlap.py b/tests/bugs/distribute/overlap.py
index 726389a78d6..5416991b7a3 100755
--- a/tests/bugs/distribute/overlap.py
+++ b/tests/bugs/distribute/overlap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import sys
diff --git a/tests/bugs/nfs/socket-as-fifo.py b/tests/bugs/nfs/socket-as-fifo.py
index 796b8ef671b..2c8ef26a804 100755
--- a/tests/bugs/nfs/socket-as-fifo.py
+++ b/tests/bugs/nfs/socket-as-fifo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Create a unix domain socket and test if it is a socket (and not a fifo/pipe).
#
diff --git a/tests/features/ipctest.py b/tests/features/ipctest.py
index b64d4f86895..9ff7a271cf2 100755
--- a/tests/features/ipctest.py
+++ b/tests/features/ipctest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import ctypes
diff --git a/tests/utils/create-files.py b/tests/utils/create-files.py
index 594072a359a..6b72a853509 100755
--- a/tests/utils/create-files.py
+++ b/tests/utils/create-files.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# This script was developed by Vijaykumar Koppad (vkoppad@redhat.com)
# The latest version of this script can found at
diff --git a/tests/utils/getfattr.py b/tests/utils/getfattr.py
index b0dba822d64..e2357901a93 100755
--- a/tests/utils/getfattr.py
+++ b/tests/utils/getfattr.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import os
diff --git a/tests/utils/gfid-access.py b/tests/utils/gfid-access.py
index 6d892a37b2e..377c504270f 100755
--- a/tests/utils/gfid-access.py
+++ b/tests/utils/gfid-access.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
#
# Copyright (c) 2011-2014 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.
diff --git a/tests/utils/pidof.py b/tests/utils/pidof.py
index 9f4a6a48a39..19deeb1fe21 100755
--- a/tests/utils/pidof.py
+++ b/tests/utils/pidof.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import sys
diff --git a/tests/utils/setfattr.py b/tests/utils/setfattr.py
index 9a7daeb1be4..364ad8b6966 100755
--- a/tests/utils/setfattr.py
+++ b/tests/utils/setfattr.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
import os
import sys
diff --git a/tools/gfind_missing_files/gfid_to_path.py b/tools/gfind_missing_files/gfid_to_path.py
index c319319e9da..01e08a9494a 100644
--- a/tools/gfind_missing_files/gfid_to_path.py
+++ b/tools/gfind_missing_files/gfid_to_path.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com/>
# This file is part of GlusterFS.
diff --git a/tools/glusterfind/S57glusterfind-delete-post.py b/tools/glusterfind/S57glusterfind-delete-post.py
index 662ef460bec..5b5142d775a 100755
--- a/tools/glusterfind/S57glusterfind-delete-post.py
+++ b/tools/glusterfind/S57glusterfind-delete-post.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
import os
import shutil
from errno import ENOENT
diff --git a/tools/glusterfind/glusterfind.in b/tools/glusterfind/glusterfind.in
index 3af04d46539..79f06faeae0 100644
--- a/tools/glusterfind/glusterfind.in
+++ b/tools/glusterfind/glusterfind.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com/>
# This file is part of GlusterFS.
diff --git a/tools/glusterfind/src/brickfind.py b/tools/glusterfind/src/brickfind.py
index 7745635970b..6597aa1ba7c 100644
--- a/tools/glusterfind/src/brickfind.py
+++ b/tools/glusterfind/src/brickfind.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com/>
diff --git a/tools/glusterfind/src/changelog.py b/tools/glusterfind/src/changelog.py
index 3c8df401c45..fab6dbbdab7 100644
--- a/tools/glusterfind/src/changelog.py
+++ b/tools/glusterfind/src/changelog.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com/>
diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py
index c9fef18c095..dd44cfbfb74 100644
--- a/tools/glusterfind/src/main.py
+++ b/tools/glusterfind/src/main.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com/>
diff --git a/tools/glusterfind/src/nodeagent.py b/tools/glusterfind/src/nodeagent.py
index c2996da78b5..c36341f216e 100644
--- a/tools/glusterfind/src/nodeagent.py
+++ b/tools/glusterfind/src/nodeagent.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com/>
diff --git a/xlators/experimental/fdl/src/gen_dumper.py b/xlators/experimental/fdl/src/gen_dumper.py
index c15f7c8870d..15221544b1c 100755
--- a/xlators/experimental/fdl/src/gen_dumper.py
+++ b/xlators/experimental/fdl/src/gen_dumper.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import os
diff --git a/xlators/experimental/fdl/src/gen_fdl.py b/xlators/experimental/fdl/src/gen_fdl.py
index 8647ba7b6f1..467ec8927b7 100755
--- a/xlators/experimental/fdl/src/gen_fdl.py
+++ b/xlators/experimental/fdl/src/gen_fdl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import os
diff --git a/xlators/experimental/fdl/src/gen_recon.py b/xlators/experimental/fdl/src/gen_recon.py
index 0934e2b3d4e..0766f61320a 100755
--- a/xlators/experimental/fdl/src/gen_recon.py
+++ b/xlators/experimental/fdl/src/gen_recon.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import os
diff --git a/xlators/experimental/jbr-client/src/gen-fops.py b/xlators/experimental/jbr-client/src/gen-fops.py
index 47b339910d4..a5ddf577fbe 100755
--- a/xlators/experimental/jbr-client/src/gen-fops.py
+++ b/xlators/experimental/jbr-client/src/gen-fops.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import os
diff --git a/xlators/experimental/jbr-server/src/gen-fops.py b/xlators/experimental/jbr-server/src/gen-fops.py
index bf6ff912d0c..616782bba45 100755
--- a/xlators/experimental/jbr-server/src/gen-fops.py
+++ b/xlators/experimental/jbr-server/src/gen-fops.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# This script generates the boilerplate versions of most fops and cbks in the
# server. This allows the details of leadership-status checking, sequencing
diff --git a/xlators/features/changelog/lib/examples/python/changes.py b/xlators/features/changelog/lib/examples/python/changes.py
index 077c1108cce..c410d3b000d 100644
--- a/xlators/features/changelog/lib/examples/python/changes.py
+++ b/xlators/features/changelog/lib/examples/python/changes.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from __future__ import print_function
import os
diff --git a/xlators/features/glupy/src/Makefile.am b/xlators/features/glupy/src/Makefile.am
index b5d1c964432..25fd48ba176 100644
--- a/xlators/features/glupy/src/Makefile.am
+++ b/xlators/features/glupy/src/Makefile.am
@@ -4,24 +4,23 @@ xlator_LTLIBRARIES = glupy.la
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features
glupydir = $(xlatordir)/glupy
-AM_CPPFLAGS = $(PYTHONDEV_CPPFLAGS) $(GF_CPPFLAGS) \
+AM_CPPFLAGS = $(GF_CPPFLAGS) \
-I$(top_srcdir)/libglusterfs/src \
- -I$(top_srcdir)/rpc/xdr/src -I$(top_builddir)/rpc/xdr/src \
- -isystem $(BUILD_PYTHON_INC)
+ -I$(top_srcdir)/rpc/xdr/src -I$(top_builddir)/rpc/xdr/src
-AM_CFLAGS = $(PYTHONDEV_CPPFLAGS) -Wall -fno-strict-aliasing \
+AM_CFLAGS = -Wall -fno-strict-aliasing \
-DGLUSTER_PYTHON_PATH=\"$(glupydir)\" \
-DPATH_GLUSTERFS_GLUPY_MODULE=\"${xlatordir}/glupy${shrext_cmds}\" \
- $(GF_CFLAGS)
+ $(GF_CFLAGS) $(PYTHON_CFLAGS)
# Flags to build glupy.so with
-glupy_la_LDFLAGS = $(PYTHONDEV_LDFLAGS) -module -avoid-version -nostartfiles \
+glupy_la_LDFLAGS = -module -avoid-version -nostartfiles \
-export-symbols $(top_srcdir)/xlators/features/glupy/src/glupy.sym \
- $(GF_NO_UNDEFINED)
+ $(GF_NO_UNDEFINED) $(PYTHON_LIBS)
glupy_la_SOURCES = glupy.c
glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
- -lpthread -l$(BUILD_PYTHON_LIB) $(LIB_DL)
+ -lpthread $(LIB_DL)
noinst_HEADERS = glupy.h
diff --git a/xlators/features/glupy/src/__init__.py.in b/xlators/features/glupy/src/__init__.py.in
index 2a66079de12..3a28658e401 100644
--- a/xlators/features/glupy/src/__init__.py.in
+++ b/xlators/features/glupy/src/__init__.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)