First of all, while PEP 394 recommends this, it's not what's common practice 
amongst distros, where Arch not even being a RPM based distro makes it less 
relevant.

I know of no rpm based distros where /usr/bin/python isn't pointing to the 
default python interpreter binary version. Also using shell aliases to set the 
default binary to use isn't really a good idea as these aliases are internal to 
the shell instance itself only in contrast to environment variables and paths.

While python upstream plans to EOL python 2 in two years, distributions 
interest and priorities aren't the same. The usual approach is to either only 
keep python 2 around untill everything still depending on and not ported to 
py3k and/or at least not install any python2 packages by default, where if 
/usr/bin/python had to point to python2, that would leave one in a tricky 
situation if only python 3 is installed.

However, if you really think this is a necessity (where forcing distros still 
using python2 to patch the shebang themself would be considered less acceptable 
than not adhering to PEP 394), the patch betlow would be the more proper way to 
achieve your goal.

This one also ensures that this $PYTHON is used for both %__python and the 
python bindings as well.
``
From 2ca7cc81357fc61fd017bae0cf3c109345224216 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= <proyv...@moondrake.org>
Date: Thu, 4 May 2017 14:30:54 +0200
Subject: [PATCH] allow to set default python interpreter with $PYTHON during
 ./configure

---
 configure.ac                                        | 3 ++-
 python/setup.py.in                                  | 2 +-
 scripts/{pythondistdeps.py => pythondistdeps.py.in} | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
 rename scripts/{pythondistdeps.py => pythondistdeps.py.in} (99%)

diff --git a/configure.ac b/configure.ac
index b41a4c9..0f8c202 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,7 +129,7 @@ AC_MSG_CHECKING(old version of patch)
 
 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
-AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH) 
+AC_PATH_PROG(__PYTHON, [$PYTHON python], $PYTHON, [/usr/bin/python], $MYPATH)
 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
@@ -1016,5 +1016,6 @@ AC_CONFIG_FILES([Makefile
        tests/Makefile
        plugins/Makefile
        python/setup.py
+       scripts/pythondistdeps.py
   ])
 AC_OUTPUT
diff --git a/python/setup.py.in b/python/setup.py.in
index 87c7358..534688b 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!@__PYTHON@
 
 from distutils.core import setup, Extension
 import subprocess
diff --git a/scripts/pythondistdeps.py b/scripts/pythondistdeps.py.in
similarity index 99%
rename from scripts/pythondistdeps.py
rename to scripts/pythondistdeps.py.in
index 36590ba..408a1de 100755
--- a/scripts/pythondistdeps.py
+++ b/scripts/pythondistdeps.py.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!@__PYTHON@
 # -*- coding: utf-8 -*-
 #
 # Copyright 2010 Per Øyvind Karlsen <proyv...@moondrake.org>
-- 
2.10.2



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/212#issuecomment-299175921
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to