summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2012-01-30 20:18:38 +0000
committerMike Gilbert <floppym@gentoo.org>2012-01-30 20:18:38 +0000
commit9ca694ee895fb414c0bed88a2f3c013f19a87bf7 (patch)
tree1ad72691d4f3b38677ef599cabbe3d9cccb21deb /eclass
parentFix SRC_URI, add blocker for dev-python/pisa. (diff)
downloadgentoo-2-9ca694ee895fb414c0bed88a2f3c013f19a87bf7.tar.gz
gentoo-2-9ca694ee895fb414c0bed88a2f3c013f19a87bf7.tar.bz2
gentoo-2-9ca694ee895fb414c0bed88a2f3c013f19a87bf7.zip
Detect needless usage of python_convert_shebangs(). Patch by Arfrever.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/python.eclass12
2 files changed, 13 insertions, 4 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 191c747be835..5a3c84b19e48 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.104 2012/01/30 13:11:27 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.105 2012/01/30 20:18:38 floppym Exp $
+
+ 30 Jan 2012; Mike Gilbert <floppym@gentoo.org> python.eclass:
+ Detect needless usage of python_convert_shebangs(). Patch by Arfrever.
30 Jan 2012; Justin Lecher <jlec@gentoo.org> autotools-utils.eclass:
Call glib-gettextize with --force in autotools-utils.eclass
diff --git a/eclass/python.eclass b/eclass/python.eclass
index 2e7ae8459968..66a316b95344 100644
--- a/eclass/python.eclass
+++ b/eclass/python.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.145 2012/01/21 19:48:20 floppym Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.146 2012/01/30 20:18:38 floppym Exp $
# @ECLASS: python.eclass
# @MAINTAINER:
@@ -11,7 +11,7 @@
# Must call inherit before EXPORT_FUNCTIONS to avoid QA warning.
if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
- inherit multilib
+ inherit eutils multilib
fi
# Export pkg_setup every time to avoid issues with eclass inheritance order.
@@ -484,7 +484,7 @@ _PYTHON_SHEBANG_BASE_PART_REGEX='^#![[:space:]]*([^[:space:]]*/usr/bin/env[[:spa
python_convert_shebangs() {
_python_check_python_pkg_setup_execution
- local argument file files=() only_executables="0" python_interpreter quiet="0" recursive="0"
+ local argument file files=() only_executables="0" python_interpreter quiet="0" recursive="0" shebangs_converted="0"
while (($#)); do
case "$1" in
@@ -549,6 +549,8 @@ python_convert_shebangs() {
if [[ "$(head -n1 "${file}")" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX} ]]; then
[[ "$(sed -ne "2p" "${file}")" =~ ^"# Gentoo '".*"' wrapper script generated by python_generate_wrapper_scripts()"$ ]] && continue
+ shebangs_converted="1"
+
if [[ "${quiet}" == "0" ]]; then
einfo "Converting shebang in '${file}'"
fi
@@ -556,6 +558,10 @@ python_convert_shebangs() {
sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?\(jython\|pypy-c\|python\)\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${python_interpreter}\6:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
fi
done
+
+ if [[ "${shebangs_converted}" == "0" ]]; then
+ eqawarn "${FUNCNAME}(): Python scripts not found"
+ fi
}
# @FUNCTION: python_clean_py-compile_files