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 --- 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 +- 11 files changed, 12 insertions(+), 10 deletions(-) (limited to 'geo-replication') diff --git a/geo-replication/src/peer_georep-sshkey.py.in b/geo-replication/src/peer_georep-sshkey.py.in index 400f29d64f..c35865db22 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 ec514f038e..89bb0c0ba6 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 be182c5a7d..8f2367b7d4 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 4fb8d254de..5eade137d2 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 2042fa9cdf..5846b9b5f2 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 3458898646..1ab6587746 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 1df2433043..b1fed727cb 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 23adbfa517..13065ca3d3 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 23adbfa517..13065ca3d3 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 a65d659e35..b4ce8fa053 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 736ae274b8..fe439a50b3 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. -- cgit