From 29024cfdd5f131c7e3085cbddf9bd1cf60359960 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Wed, 28 Mar 2018 10:14:39 -0400 Subject: core/build/various: python3 compat, prepare for python2 -> python3 Note 1) we're not supposed to be using #!/usr/bin/env python, see https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Shebang_lines Note 2) we're also not supposed to be using "!/usr/bin/python, see https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build#Quick_Opt-Out The previous patch (https://review.gluster.org/19767) tried to do too much in one patch, so it was abandoned. This patch does two things: 1) minor cleanup of configure(.ac) to explicitly use python2 2) change all the shebang lines to #!/usr/bin/python2 and add them where they were missing based on warnings emitted during rpmbuild. In a follow-up patch python2 will eventually be changed to python3. Before that python2-isms (e.g. print, string.join(), etc.) need to be converted to python3. Some of those can be rewritten in version agnostic python. E.g. print statements become print() with "from __future_ import print_function". The python 2to3 utility will be used for some of those. Also Aravinda has given guidance in the comments to the first patch for changes. updates: #411 Change-Id: I471730962b2526022115a1fc33629fb078b74338 Signed-off-by: Kaleb S. KEITHLEY --- api/examples/getvolfile.py | 2 +- configure.ac | 91 +++++++++++----------- contrib/ipaddr-py/ipaddr.py | 2 +- contrib/ipaddr-py/ipaddr_test.py | 2 +- contrib/ipaddr-py/setup.py | 2 +- events/eventskeygen.py | 2 +- events/src/gf_event.py | 2 +- events/src/glustereventsd.py | 2 +- events/src/peer_eventsapi.py | 2 +- events/tools/eventsdash.py | 2 +- extras/cliutils/README.md | 4 +- extras/create_new_xlator/generate_xlator.py | 2 +- .../distributed-testing/distributed-test-runner.py | 2 +- extras/failed-tests.py | 2 +- extras/geo-rep/schedule_georep.py.in | 2 +- extras/git-branch-diff.py | 2 +- extras/hook-scripts/S40ufo-stop.py | 2 +- extras/profiler/glusterfs-profiler | 2 +- extras/prot_filter.py | 2 +- extras/quota/xattr_analysis.py | 4 +- extras/rebalance.py | 2 +- extras/snap_scheduler/conf.py.in | 1 + extras/snap_scheduler/gcron.py | 2 +- extras/snap_scheduler/snap_scheduler.py | 2 +- geo-replication/src/peer_georep-sshkey.py.in | 2 +- geo-replication/src/peer_mountbroker.in | 3 +- geo-replication/src/peer_mountbroker.py.in | 2 +- geo-replication/syncdaemon/changelogagent.py | 2 +- geo-replication/syncdaemon/conf.py.in | 1 + geo-replication/syncdaemon/gsyncd.py | 2 +- geo-replication/syncdaemon/gsyncdstatus.py | 2 +- geo-replication/tests/__init__.py | 2 +- geo-replication/tests/unit/__init__.py | 2 +- geo-replication/tests/unit/test_gsyncdstatus.py | 2 +- geo-replication/tests/unit/test_syncdutils.py | 2 +- libglusterfs/src/gen-defaults.py | 2 +- libglusterfs/src/generator.py | 2 +- tests/bugs/distribute/overlap.py | 2 +- tests/bugs/nfs/socket-as-fifo.py | 2 +- tests/features/ipctest.py | 2 +- tests/utils/create-files.py | 2 +- tests/utils/getfattr.py | 2 +- tests/utils/gfid-access.py | 2 +- tests/utils/pidof.py | 2 +- tests/utils/setfattr.py | 2 +- tools/gfind_missing_files/gfid_to_path.py | 2 +- tools/glusterfind/S57glusterfind-delete-post.py | 2 +- tools/glusterfind/glusterfind.in | 2 +- tools/glusterfind/src/brickfind.py | 2 +- tools/glusterfind/src/changelog.py | 2 +- tools/glusterfind/src/main.py | 2 +- tools/glusterfind/src/nodeagent.py | 2 +- xlators/experimental/fdl/src/gen_dumper.py | 2 +- xlators/experimental/fdl/src/gen_fdl.py | 2 +- xlators/experimental/fdl/src/gen_recon.py | 2 +- xlators/experimental/jbr-client/src/gen-fops.py | 2 +- xlators/experimental/jbr-server/src/gen-fops.py | 2 +- .../changelog/lib/examples/python/changes.py | 2 +- xlators/features/glupy/src/__init__.py.in | 2 + 59 files changed, 108 insertions(+), 102 deletions(-) diff --git a/api/examples/getvolfile.py b/api/examples/getvolfile.py index 32c2268b313..961a89c9808 100755 --- a/api/examples/getvolfile.py +++ b/api/examples/getvolfile.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import ctypes import ctypes.util diff --git a/configure.ac b/configure.ac index 81eca4976a1..190dc8f73fc 100644 --- a/configure.ac +++ b/configure.ac @@ -597,41 +597,46 @@ fi dnl Check Python Availability have_python=no -AM_PATH_PYTHON(,, [:]) -if test "$PYTHON" != ":"; then +case $host_os in + freebsd*) + PYTHON=/usr/local/bin/python2 + ;; + *) + PYTHON=/usr/bin/python2 + ;; +esac +AM_PATH_PYTHON([2.6],,[:]) +if test "x${PYTHON}" != "x:"; 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_python2=no -have_Python_h=no +have_Python_h="no" -if echo $PYTHON_VERSION | grep -q ^2; then - have_python2=yes +dnl Use pkg-config to get runtime search patch 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) - dnl Use pkg-config to get runtime search patch 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'` - 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 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`" - 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`" +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} - 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],[]) -fi +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) @@ -816,25 +821,20 @@ case $host_os in ;; esac SYNCDAEMON_COMPILE=0 -if test "x${with_server}" = "xyes" -a "x$enable_georeplication" != "xno"; then - SYNCDAEMON_SUBDIR=geo-replication - SYNCDAEMON_COMPILE=1 - - BUILD_SYNCDAEMON="yes" - AM_PATH_PYTHON([2.4]) - echo -n "checking if python is python 2.x... " - if echo $PYTHON_VERSION | grep ^2; then - : - else - echo no - AC_MSG_ERROR([only python 2.x is supported]) - fi - echo -n "checking if python has ctypes support... " - if "$PYTHON" -c 'import ctypes' 2>/dev/null; then - echo yes +if test "x${with_server}" = "xyes" -a "x${enable_georeplication}" != "xno"; then + if test "x${have_python}" = "xno" ; then + AC_MSG_ERROR([only python 2 and 3 are supported]) else - echo no - AC_MSG_ERROR([python does not have ctypes support]) + SYNCDAEMON_SUBDIR=geo-replication + SYNCDAEMON_COMPILE=1 + + BUILD_SYNCDAEMON="yes" + AC_MSG_CHECKING([if python has ctypes support...]) + if "${PYTHON}" -c 'import ctypes' 2>/dev/null; then + AC_MSG_RESULT("yes") + else + AC_MSG_ERROR([python does not have ctypes support]) + fi fi fi AC_SUBST(SYNCDAEMON_COMPILE) @@ -862,11 +862,11 @@ if test "x$enable_events" != "xno"; then BUILD_EVENTS="yes" - if test "x$have_python2" = "xno"; then - if test "x$enable_events" = "xyes"; then - AC_MSG_ERROR([python 2.x packages required. exiting..]) + if test "x${have_python}" = "xno"; then + if test "x${enable_events}" = "xyes"; then + AC_MSG_ERROR([python 2 or 3 required. exiting.]) fi - AC_MSG_WARN([python 2.x not found, disabling events]) + AC_MSG_WARN([python not found, disabling events]) EVENTS_SUBDIR= EVENTS_ENABLED=0 BUILD_EVENTS="no" @@ -876,7 +876,7 @@ if test "x$enable_events" != "xno"; then fi AC_SUBST(EVENTS_ENABLED) AC_SUBST(EVENTS_SUBDIR) -AM_CONDITIONAL([BUILD_EVENTS], [test x$BUILD_EVENTS = xyes]) +AM_CONDITIONAL([BUILD_EVENTS], [test "x${BUILD_EVENTS}" = "xyes"]) # end Events section # CDC xlator - check if libz is present if so enable HAVE_LIB_Z @@ -1409,7 +1409,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_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then + if test "x${have_python}" = "xyes" -a "x${have_Python_h}" = "xyes"; then case $host_os in darwin*) BUILD_GLUPY=no @@ -1698,4 +1698,5 @@ echo "Server components : $with_server" echo "Legacy gNFS server : $BUILD_GNFS" echo "IPV6 default : $with_ipv6_default" echo "Use TIRPC : $with_libtirpc" +echo "With Python : ${PYTHON_VERSION}" echo diff --git a/contrib/ipaddr-py/ipaddr.py b/contrib/ipaddr-py/ipaddr.py index a89298a315d..07fc873fb15 100644 --- a/contrib/ipaddr-py/ipaddr.py +++ b/contrib/ipaddr-py/ipaddr.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # # Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. diff --git a/contrib/ipaddr-py/ipaddr_test.py b/contrib/ipaddr-py/ipaddr_test.py index 09bece0e751..642466fa2ce 100755 --- a/contrib/ipaddr-py/ipaddr_test.py +++ b/contrib/ipaddr-py/ipaddr_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # # Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. diff --git a/contrib/ipaddr-py/setup.py b/contrib/ipaddr-py/setup.py index 33564320e45..5561bbec7b0 100755 --- a/contrib/ipaddr-py/setup.py +++ b/contrib/ipaddr-py/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # # Copyright 2008 Google Inc. # diff --git a/events/eventskeygen.py b/events/eventskeygen.py index 98c26dcbcb1..3badc05f359 100644 --- a/events/eventskeygen.py +++ b/events/eventskeygen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. diff --git a/events/src/gf_event.py b/events/src/gf_event.py index f9ece6adc28..fd272434242 100644 --- a/events/src/gf_event.py +++ b/events/src/gf_event.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. diff --git a/events/src/glustereventsd.py b/events/src/glustereventsd.py index 606b89cbd7f..32fb6c52aa9 100644 --- a/events/src/glustereventsd.py +++ b/events/src/glustereventsd.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. diff --git a/events/src/peer_eventsapi.py b/events/src/peer_eventsapi.py index d72fdbe99c4..fb11e12deb4 100644 --- a/events/src/peer_eventsapi.py +++ b/events/src/peer_eventsapi.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. diff --git a/events/tools/eventsdash.py b/events/tools/eventsdash.py index 47fc56dda6e..dc03a61983f 100644 --- a/events/tools/eventsdash.py +++ b/events/tools/eventsdash.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. diff --git a/extras/cliutils/README.md b/extras/cliutils/README.md index ccb60802c3d..2e0ffe772c7 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/env python + #!/usr/bin/python2 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/env python + #!/usr/bin/python2 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 2dbf470eafb..c51c3a41a22 100755 --- a/extras/create_new_xlator/generate_xlator.py +++ b/extras/create_new_xlator/generate_xlator.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import os import re import sys diff --git a/extras/distributed-testing/distributed-test-runner.py b/extras/distributed-testing/distributed-test-runner.py index 9a74b7ab5c5..68418fabfaf 100755 --- a/extras/distributed-testing/distributed-test-runner.py +++ b/extras/distributed-testing/distributed-test-runner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 from __future__ import absolute_import from __future__ import division diff --git a/extras/failed-tests.py b/extras/failed-tests.py index 476e24331e5..8391d229b45 100755 --- a/extras/failed-tests.py +++ b/extras/failed-tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import blessings import requests diff --git a/extras/geo-rep/schedule_georep.py.in b/extras/geo-rep/schedule_georep.py.in index 1887fe7ba87..6462d8fdba7 100644 --- a/extras/geo-rep/schedule_georep.py.in +++ b/extras/geo-rep/schedule_georep.py.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 """ Schedule Geo-replication ------------------------ diff --git a/extras/git-branch-diff.py b/extras/git-branch-diff.py index c8d74ec9f31..c9e9dd0da06 100755 --- a/extras/git-branch-diff.py +++ b/extras/git-branch-diff.py @@ -1,4 +1,4 @@ -#!/bin/env python +#!/bin/python2 """ Copyright (c) 2016 Red Hat, Inc. diff --git a/extras/hook-scripts/S40ufo-stop.py b/extras/hook-scripts/S40ufo-stop.py index 107f1968355..48ee1c788b6 100755 --- a/extras/hook-scripts/S40ufo-stop.py +++ b/extras/hook-scripts/S40ufo-stop.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 import os from optparse import OptionParser diff --git a/extras/profiler/glusterfs-profiler b/extras/profiler/glusterfs-profiler index 65d445864aa..9c76d5b379c 100755 --- a/extras/profiler/glusterfs-profiler +++ b/extras/profiler/glusterfs-profiler @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # Copyright (c) 2006-2012 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/extras/prot_filter.py b/extras/prot_filter.py index 7dccacf155e..290792697a2 100755 --- a/extras/prot_filter.py +++ b/extras/prot_filter.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 """ Copyright (c) 2013 Red Hat, Inc. diff --git a/extras/quota/xattr_analysis.py b/extras/quota/xattr_analysis.py index d3d1a74170b..512fcd39b88 100755 --- a/extras/quota/xattr_analysis.py +++ b/extras/quota/xattr_analysis.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -# Below script has to purpose +#!/usr/bin/python2 +# 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. # (If there are any directory with contri and size mismatch that are not dirty diff --git a/extras/rebalance.py b/extras/rebalance.py index 9579e5616ad..b2ec6a52290 100755 --- a/extras/rebalance.py +++ b/extras/rebalance.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import atexit import copy diff --git a/extras/snap_scheduler/conf.py.in b/extras/snap_scheduler/conf.py.in index 6dcca0534a7..e04b6cb008b 100644 --- a/extras/snap_scheduler/conf.py.in +++ b/extras/snap_scheduler/conf.py.in @@ -1,3 +1,4 @@ +#!/usr/bin/python2 # # Copyright (c) 2016 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py index d72057861ff..3f2ba388ccc 100755 --- a/extras/snap_scheduler/gcron.py +++ b/extras/snap_scheduler/gcron.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # Copyright (c) 2015 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py index c6600a4a3d7..a22c0bccbf3 100755 --- a/extras/snap_scheduler/snap_scheduler.py +++ b/extras/snap_scheduler/snap_scheduler.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # Copyright (c) 2015 Red Hat, Inc. # 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 400f29d64f3..c35865db224 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/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. diff --git a/geo-replication/src/peer_mountbroker.in b/geo-replication/src/peer_mountbroker.in index ec514f038e1..89bb0c0ba6f 100644 --- a/geo-replication/src/peer_mountbroker.in +++ b/geo-replication/src/peer_mountbroker.in @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/python2 + import os from argparse import ArgumentParser, RawDescriptionHelpFormatter import json diff --git a/geo-replication/src/peer_mountbroker.py.in b/geo-replication/src/peer_mountbroker.py.in index be182c5a7de..8f2367b7d49 100644 --- a/geo-replication/src/peer_mountbroker.py.in +++ b/geo-replication/src/peer_mountbroker.py.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 import os from errno import EEXIST, ENOENT diff --git a/geo-replication/syncdaemon/changelogagent.py b/geo-replication/syncdaemon/changelogagent.py index 4fb8d254dea..5eade137d25 100644 --- a/geo-replication/syncdaemon/changelogagent.py +++ b/geo-replication/syncdaemon/changelogagent.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # Copyright (c) 2011-2014 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/geo-replication/syncdaemon/conf.py.in b/geo-replication/syncdaemon/conf.py.in index 2042fa9cdfb..5846b9b5f26 100644 --- a/geo-replication/syncdaemon/conf.py.in +++ b/geo-replication/syncdaemon/conf.py.in @@ -1,3 +1,4 @@ +#!/usr/bin/python2 # # Copyright (c) 2016 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py index 3458898646e..1ab65877467 100644 --- a/geo-replication/syncdaemon/gsyncd.py +++ b/geo-replication/syncdaemon/gsyncd.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 from argparse import ArgumentParser import time import os diff --git a/geo-replication/syncdaemon/gsyncdstatus.py b/geo-replication/syncdaemon/gsyncdstatus.py index 1df24330438..b1fed727cbe 100644 --- a/geo-replication/syncdaemon/gsyncdstatus.py +++ b/geo-replication/syncdaemon/gsyncdstatus.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # Copyright (c) 2011-2014 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/geo-replication/tests/__init__.py b/geo-replication/tests/__init__.py index 23adbfa5171..13065ca3d3c 100644 --- a/geo-replication/tests/__init__.py +++ b/geo-replication/tests/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # Copyright (c) 2011-2014 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/geo-replication/tests/unit/__init__.py b/geo-replication/tests/unit/__init__.py index 23adbfa5171..13065ca3d3c 100644 --- a/geo-replication/tests/unit/__init__.py +++ b/geo-replication/tests/unit/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # Copyright (c) 2011-2014 Red Hat, Inc. # 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 a65d659e356..b4ce8fa053b 100644 --- a/geo-replication/tests/unit/test_gsyncdstatus.py +++ b/geo-replication/tests/unit/test_gsyncdstatus.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # Copyright (c) 2011-2014 Red Hat, Inc. # 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 736ae274b85..fe439a50b38 100644 --- a/geo-replication/tests/unit/test_syncdutils.py +++ b/geo-replication/tests/unit/test_syncdutils.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # Copyright (c) 2011-2014 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/libglusterfs/src/gen-defaults.py b/libglusterfs/src/gen-defaults.py index f8e76d02ef4..b94fbe1444e 100644 --- a/libglusterfs/src/gen-defaults.py +++ b/libglusterfs/src/gen-defaults.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import sys from generator import ops, fop_subs, cbk_subs, generate diff --git a/libglusterfs/src/generator.py b/libglusterfs/src/generator.py index 3072382c7a5..29e02782638 100755 --- a/libglusterfs/src/generator.py +++ b/libglusterfs/src/generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import string diff --git a/tests/bugs/distribute/overlap.py b/tests/bugs/distribute/overlap.py index 15f2da473f1..253bb4052ec 100755 --- a/tests/bugs/distribute/overlap.py +++ b/tests/bugs/distribute/overlap.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import sys diff --git a/tests/bugs/nfs/socket-as-fifo.py b/tests/bugs/nfs/socket-as-fifo.py index 1fce5b96896..da9886ea364 100755 --- a/tests/bugs/nfs/socket-as-fifo.py +++ b/tests/bugs/nfs/socket-as-fifo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # # 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 93392486140..e89642f589b 100755 --- a/tests/features/ipctest.py +++ b/tests/features/ipctest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import ctypes diff --git a/tests/utils/create-files.py b/tests/utils/create-files.py index bef4201bf1f..71f967f4fdb 100755 --- a/tests/utils/create-files.py +++ b/tests/utils/create-files.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/python2 # 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 1a8369af7c4..6636644f67c 100755 --- a/tests/utils/getfattr.py +++ b/tests/utils/getfattr.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/python2 import os import sys diff --git a/tests/utils/gfid-access.py b/tests/utils/gfid-access.py index 81258073da1..4ca1665fec4 100755 --- a/tests/utils/gfid-access.py +++ b/tests/utils/gfid-access.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/python2 # # Copyright (c) 2011-2014 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/tests/utils/pidof.py b/tests/utils/pidof.py index 575b899b6cc..01f2f0ad5bd 100755 --- a/tests/utils/pidof.py +++ b/tests/utils/pidof.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 import sys diff --git a/tests/utils/setfattr.py b/tests/utils/setfattr.py index d714d05edf3..159218d8bef 100755 --- a/tests/utils/setfattr.py +++ b/tests/utils/setfattr.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/python2 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 8362f68b955..c319319e9da 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/env python +#!/usr/bin/python2 # Copyright (c) 2015 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/tools/glusterfind/S57glusterfind-delete-post.py b/tools/glusterfind/S57glusterfind-delete-post.py index fb6c222df03..662ef460bec 100755 --- a/tools/glusterfind/S57glusterfind-delete-post.py +++ b/tools/glusterfind/S57glusterfind-delete-post.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import os import shutil from errno import ENOENT diff --git a/tools/glusterfind/glusterfind.in b/tools/glusterfind/glusterfind.in index cff8973980a..3af04d46539 100644 --- a/tools/glusterfind/glusterfind.in +++ b/tools/glusterfind/glusterfind.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # Copyright (c) 2015 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/tools/glusterfind/src/brickfind.py b/tools/glusterfind/src/brickfind.py index e914bacd4ab..6b430d3b9d2 100644 --- a/tools/glusterfind/src/brickfind.py +++ b/tools/glusterfind/src/brickfind.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # Copyright (c) 2015 Red Hat, Inc. diff --git a/tools/glusterfind/src/changelog.py b/tools/glusterfind/src/changelog.py index 2376af26e72..b124ae7e168 100644 --- a/tools/glusterfind/src/changelog.py +++ b/tools/glusterfind/src/changelog.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # Copyright (c) 2015 Red Hat, Inc. diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py index 63de6d06410..3e7a729338c 100644 --- a/tools/glusterfind/src/main.py +++ b/tools/glusterfind/src/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # Copyright (c) 2015 Red Hat, Inc. diff --git a/tools/glusterfind/src/nodeagent.py b/tools/glusterfind/src/nodeagent.py index 07d82826e0d..e921bc0df43 100644 --- a/tools/glusterfind/src/nodeagent.py +++ b/tools/glusterfind/src/nodeagent.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python2 # -*- coding: utf-8 -*- # Copyright (c) 2015 Red Hat, Inc. diff --git a/xlators/experimental/fdl/src/gen_dumper.py b/xlators/experimental/fdl/src/gen_dumper.py index 42db55d2cb3..2950be44e01 100755 --- a/xlators/experimental/fdl/src/gen_dumper.py +++ b/xlators/experimental/fdl/src/gen_dumper.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import os import re diff --git a/xlators/experimental/fdl/src/gen_fdl.py b/xlators/experimental/fdl/src/gen_fdl.py index d59f12a4841..136aa112861 100755 --- a/xlators/experimental/fdl/src/gen_fdl.py +++ b/xlators/experimental/fdl/src/gen_fdl.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import os import sys diff --git a/xlators/experimental/fdl/src/gen_recon.py b/xlators/experimental/fdl/src/gen_recon.py index 57a5360a9f8..295df699f6e 100755 --- a/xlators/experimental/fdl/src/gen_recon.py +++ b/xlators/experimental/fdl/src/gen_recon.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 import os import re diff --git a/xlators/experimental/jbr-client/src/gen-fops.py b/xlators/experimental/jbr-client/src/gen-fops.py index 4d9451f7177..64bd8b06cae 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/python +#!/usr/bin/python2 import os import re diff --git a/xlators/experimental/jbr-server/src/gen-fops.py b/xlators/experimental/jbr-server/src/gen-fops.py index c4a5556a8fa..2005e3932d4 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/python +#!/usr/bin/python2 # 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 221df642a36..c0341b52ca3 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/python +#!/usr/bin/python2 import os import sys diff --git a/xlators/features/glupy/src/__init__.py.in b/xlators/features/glupy/src/__init__.py.in index 3ad9513f40e..2a66079de12 100644 --- a/xlators/features/glupy/src/__init__.py.in +++ b/xlators/features/glupy/src/__init__.py.in @@ -1,2 +1,4 @@ +#!/usr/bin/python2 + from pkgutil import extend_path __path__ = extend_path(__path__, __name__) -- cgit