[python3/f20: 1/2] Rewrite the config wrapper from Bash to Python, so it can be interpreted with Python

Miro Hrončok churchyard at fedoraproject.org
Mon Jun 30 16:59:37 UTC 2014


commit 303eacc5e0218f9b5fa13e90171bd544aefd6bf9
Author: Miro Hrončok <miro at hroncok.cz>
Date:   Mon Jun 30 18:58:19 2014 +0200

    Rewrite the config wrapper from Bash to Python, so it can be interpreted with Python

 config.py    |    9 +++++++++
 python3.spec |   15 +++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/config.py b/config.py
new file mode 100644
index 0000000..964d5d9
--- /dev/null
+++ b/config.py
@@ -0,0 +1,9 @@
+#!/bin/python3
+import sys
+import subprocess
+ver = sys.version[:3]
+arch = subprocess.check_output('uname -m'.split()).decode("utf-8").rstrip()
+call = ['python{ver}m-{arch}-config'.format(ver=ver, arch=arch)] + sys.argv[1:]
+retval = subprocess.call(call)
+if retval == 127:
+    print('Could not find python{ver}m-{arch}-config. Look around to see available arches.'.format(ver=ver, arch=arch), file=sys.stderr)
diff --git a/python3.spec b/python3.spec
index 50ee0d4..505c698 100644
--- a/python3.spec
+++ b/python3.spec
@@ -126,7 +126,7 @@
 Summary: Version 3 of the Python programming language aka Python 3000
 Name: python3
 Version: %{pybasever}.2
-Release: 15%{?dist}
+Release: 16%{?dist}
 License: Python
 Group: Development/Languages
 
@@ -222,6 +222,9 @@ Source7: pyfuntop.stp
 # Written by bkabrda
 Source8: check-pyc-and-pyo-timestamps.py
 
+# Python wrapper arounf pythonXXm-config to be able to keep python3-devel multiarch
+Source9: config.py
+
 # Fixup distutils/unixccompiler.py to remove standard library path from rpath:
 # Was Patch0 in ivazquez' python3000 specfile:
 Patch1:         Python-3.1.1-rpath.patch
@@ -1329,11 +1332,8 @@ sed \
 
 # Rename the script that differs on different arches to arch specific name
 mv %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-{,`uname -m`-}config
-echo -e '#!/bin/sh\nexec `dirname $0`/python%{LDVERSION_optimized}-`uname -m`-config "$@"' > \
-  %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
-echo '[ $? -eq 127 ] && echo "Could not find python%{LDVERSION_optimized}-`uname -m`-config. Look around to see available arches." >&2' >> \
-  %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
-  chmod +x %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
+cp %{SOURCE9} %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
+chmod +x %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
 
 # ======================================================
 # Running the upstream test suite
@@ -1773,6 +1773,9 @@ rm -fr %{buildroot}
 # ======================================================
 
 %changelog
+* Mon Jun 30 2014 Miro Hrončok <mhroncok at redhat.com> - 3.3.2-16
+- Rewrite the config wrapper from Bash to Python, so it can be interpreted with Python
+
 * Fri May 30 2014 Miro Hrončok <mhroncok at redhat.com> - 3.3.2-15
 - In config script, use uname -m to write the arch
 


More information about the scm-commits mailing list