public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michal Gorny (mgorny)" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog python-utils-r1.eclass
Date: Sat,  5 Jan 2013 10:01:21 +0000 (UTC)	[thread overview]
Message-ID: <20130105100121.103712171D@flycatcher.gentoo.org> (raw)

mgorny      13/01/05 10:01:20

  Modified:             ChangeLog python-utils-r1.eclass
  Log:
  Support converting files with python2 and python3 shebangs.

Revision  Changes    Path
1.600                eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.600&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.600&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.599&r2=1.600

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.599
retrieving revision 1.600
diff -u -r1.599 -r1.600
--- ChangeLog	5 Jan 2013 10:00:30 -0000	1.599
+++ ChangeLog	5 Jan 2013 10:01:20 -0000	1.600
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.599 2013/01/05 10:00:30 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.600 2013/01/05 10:01:20 mgorny Exp $
+
+  05 Jan 2013; Michał Górny <mgorny@gentoo.org> python-utils-r1.eclass:
+  Support converting files with python2 and python3 shebangs.
 
   05 Jan 2013; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass:
   Always write split logs, even in non-parallel builds.



1.13                 eclass/python-utils-r1.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.13&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.13&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?r1=1.12&r2=1.13

Index: python-utils-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- python-utils-r1.eclass	2 Jan 2013 21:12:44 -0000	1.12
+++ python-utils-r1.eclass	5 Jan 2013 10:01:20 -0000	1.13
@@ -1,6 +1,6 @@
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.12 2013/01/02 21:12:44 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.13 2013/01/05 10:01:20 mgorny Exp $
 
 # @ECLASS: python-utils-r1
 # @MAINTAINER:
@@ -318,17 +318,33 @@
 	local f
 	for f; do
 		local shebang=$(head -n 1 "${f}")
+		local from
 		debug-print "${FUNCNAME}: path = ${f}"
 		debug-print "${FUNCNAME}: shebang = ${shebang}"
 
-		if [[ "${shebang} " != *'python '* ]]; then
+		if [[ "${shebang} " == *'python '* ]]; then
+			from=python
+		elif [[ "${shebang} " == *'python2 '* ]]; then
+			from=python2
+		elif [[ "${shebang} " == *'python3 '* ]]; then
+			from=python3
+		else
 			eerror "A file does not seem to have a supported shebang:"
 			eerror "  file: ${f}"
 			eerror "  shebang: ${shebang}"
 			die "${FUNCNAME}: ${f} does not seem to have a valid shebang"
 		fi
 
-		sed -i -e "1s:python:${impl}:" "${f}" || die
+		if [[ ${from} == python2 && ${impl} == python3*
+				|| ${from} == python3 && ${impl} != python3* ]]; then
+			eerror "A file does have shebang not supporting requested impl:"
+			eerror "  file: ${f}"
+			eerror "  shebang: ${shebang}"
+			eerror "  impl: ${impl}"
+			die "${FUNCNAME}: ${f} does have shebang not supporting ${EPYTHON}"
+		fi
+
+		sed -i -e "1s:${from}:${impl}:" "${f}" || die
 	done
 }
 





             reply	other threads:[~2013-01-05 10:01 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-05 10:01 Michal Gorny (mgorny) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-07-27 16:35 [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog python-utils-r1.eclass Michal Gorny (mgorny)
2015-07-27 16:34 Michal Gorny (mgorny)
2015-07-27 16:34 Michal Gorny (mgorny)
2015-07-27 16:32 Michal Gorny (mgorny)
2015-07-25 10:07 Michal Gorny (mgorny)
2015-02-21  8:07 Michal Gorny (mgorny)
2015-01-02  0:15 Michal Gorny (mgorny)
2015-01-02  0:14 Michal Gorny (mgorny)
2014-12-28 18:35 Michal Gorny (mgorny)
2014-12-28 11:24 Michal Gorny (mgorny)
2014-12-27 23:52 Michal Gorny (mgorny)
2014-12-27 23:22 Michal Gorny (mgorny)
2014-12-27 19:31 Michal Gorny (mgorny)
2014-12-27 18:26 Michal Gorny (mgorny)
2014-11-29 23:03 Michal Gorny (mgorny)
2014-11-23 16:05 Mike Gilbert (floppym)
2014-11-23 16:02 Mike Gilbert (floppym)
2014-10-18 22:36 Mike Gilbert (floppym)
2014-09-04 14:52 Michal Gorny (mgorny)
2014-07-06 11:45 Michal Gorny (mgorny)
2014-06-19 15:10 Michal Gorny (mgorny)
2014-05-16  7:54 Michal Gorny (mgorny)
2014-05-01 13:34 Justin Lecher (jlec)
2014-03-13  8:10 Michal Gorny (mgorny)
2014-03-12  9:29 Michal Gorny (mgorny)
2014-03-12  9:23 Michal Gorny (mgorny)
2014-03-12  9:06 Michal Gorny (mgorny)
2014-03-12  8:18 Patrick Lauer (patrick)
2014-02-22 17:01 Mike Gilbert (floppym)
2013-10-27  7:27 Michal Gorny (mgorny)
2013-10-09 19:08 Michal Gorny (mgorny)
2013-10-09 17:23 Michal Gorny (mgorny)
2013-09-17 19:40 Michal Gorny (mgorny)
2013-09-17 17:28 Michal Gorny (mgorny)
2013-09-17 13:25 Michal Gorny (mgorny)
2013-09-16 17:58 Michal Gorny (mgorny)
2013-09-08 14:56 Michal Gorny (mgorny)
2013-09-08 14:54 Michal Gorny (mgorny)
2013-09-05  9:59 Michal Gorny (mgorny)
2013-08-28 22:04 Michal Gorny (mgorny)
2013-07-11  7:20 Michal Gorny (mgorny)
2013-07-11  6:57 Michal Gorny (mgorny)
2013-06-07  1:11 Mike Gilbert (floppym)
2013-05-31 17:40 Michal Gorny (mgorny)
2013-04-14  0:10 Mike Gilbert (floppym)
2013-03-28 12:21 Michal Gorny (mgorny)
2013-03-07 20:58 Tim Harder (radhermit)
2013-02-04 13:53 Michal Gorny (mgorny)
2013-02-04 13:52 Michal Gorny (mgorny)
2013-01-29 21:12 Michal Gorny (mgorny)
2013-01-27 16:35 Michal Gorny (mgorny)
2012-12-30 14:17 Michal Gorny (mgorny)
2012-12-27 22:56 Michal Gorny (mgorny)
2012-12-20  6:05 Mike Gilbert (floppym)
2012-12-15 21:30 Michal Gorny (mgorny)
2012-11-26 10:16 Michal Gorny (mgorny)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130105100121.103712171D@flycatcher.gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox