From ffff9d749d39c8edf3e4af70ed5c59b45c6a3e1b Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Mon, 25 Apr 2016 01:25:25 +0200 Subject: [PATCH] build-style/python-module: rename unversioned scripts, if any - No more name conflicts in case of multi-version python packages - No more manual renaming - No more manual shebang fixes - Alternatives support ok xtraeme@ --- common/build-style/python-module.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/build-style/python-module.sh b/common/build-style/python-module.sh index ca2144ec706..dafdbc591c4 100644 --- a/common/build-style/python-module.sh +++ b/common/build-style/python-module.sh @@ -49,5 +49,15 @@ do_install() { python${pyver} setup.py build --build-base=build-${pyver} \ install --prefix=/usr --root=${DESTDIR} ${make_install_args} fi + + # Rename unversioned scripts to avoid name conflicts. + if [ "$python_versions" != "2.7" -a "$python_versions" != "${python_versions#2.7}" ]; then + if [ -d ${DESTDIR}/usr/bin ]; then + find ${DESTDIR}/usr/bin -type f ! -name "*[[:digit:]]\.[[:digit:]]" | while IFS= read -r f _; do + mv "${f}" "${f}${pyver}" + echo "[python-module] Unversioned script renamed to '${f#$DESTDIR}${pyver}'" + done + fi + fi done }