public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/_emerge/
Date: Wed,  9 May 2012 20:16:26 +0000 (UTC)	[thread overview]
Message-ID: <1336594546.5958b9d406134a139cd66025eaf7bd650fb32b24.zmedico@gentoo> (raw)

commit:     5958b9d406134a139cd66025eaf7bd650fb32b24
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May  9 20:00:32 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May  9 20:15:46 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5958b9d4

Split out eapi_invalid function.

---
 pym/_emerge/EbuildMetadataPhase.py          |   48 +++++----------------------
 pym/portage/package/ebuild/_eapi_invalid.py |   46 +++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 39 deletions(-)

diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index f89077e..b7af69d 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -5,17 +5,17 @@ from _emerge.SubProcess import SubProcess
 import sys
 from portage.cache.mappings import slot_dict_class
 import portage
+portage.proxy.lazyimport.lazyimport(globals(),
+	'portage.package.ebuild._eapi_invalid:eapi_invalid',
+)
 from portage import os
 from portage import _encodings
 from portage import _unicode_decode
 from portage import _unicode_encode
-from portage.dep import _repo_separator
-from portage.elog import elog_process
-from portage.elog.messages import eerror
+
 import errno
 import fcntl
 import io
-import textwrap
 
 class EbuildMetadataPhase(SubProcess):
 
@@ -171,40 +171,10 @@ class EbuildMetadataPhase(SubProcess):
 					self.returncode = 1
 
 	def _eapi_invalid(self, metadata):
-
 		repo_name = self.portdb.getRepositoryName(self.repo_path)
-
-		msg = []
-		msg.extend(textwrap.wrap(("EAPI assignment in ebuild '%s%s%s' does not"
-			" conform with PMS section 7.3.1:") %
-			(self.cpv, _repo_separator, repo_name), 70))
-
-		if not self._eapi:
-			# None means the assignment was not found, while an
-			# empty string indicates an (invalid) empty assingment.
-			msg.append(
-				"\tvalid EAPI assignment must"
-				" occur on or before line: %s" %
-				self._eapi_lineno)
-		else:
-			msg.append(("\tbash returned EAPI '%s' which does not match "
-				"assignment on line: %s") %
-				(metadata["EAPI"], self._eapi_lineno))
-
-		if 'parse-eapi-ebuild-head' in self.settings.features:
-			msg.extend(textwrap.wrap(("NOTE: This error will soon"
-				" become unconditionally fatal in a future version of Portage,"
-				" but at this time, it can by made non-fatal by setting"
-				" FEATURES=-parse-eapi-ebuild-head in"
-				" make.conf."), 70))
+		if metadata is not None:
+			eapi_var = metadata["EAPI"]
 		else:
-			msg.extend(textwrap.wrap(("NOTE: This error will soon"
-				" become unconditionally fatal in a future version of Portage."
-				" At the earliest opportunity, please enable"
-				" FEATURES=parse-eapi-ebuild-head in make.conf in order to"
-				" make this error fatal."), 70))
-
-		for line in msg:
-			eerror(line, phase="other", key=self.cpv)
-		elog_process(self.cpv, self.settings,
-			phasefilter=("other",))
+			eapi_var = None
+		eapi_invalid(self, self.cpv, repo_name, self.settings,
+			eapi_var, self._eapi, self._eapi_lineno)

diff --git a/pym/portage/package/ebuild/_eapi_invalid.py b/pym/portage/package/ebuild/_eapi_invalid.py
new file mode 100644
index 0000000..50a6978
--- /dev/null
+++ b/pym/portage/package/ebuild/_eapi_invalid.py
@@ -0,0 +1,46 @@
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+import textwrap
+
+from portage.dep import _repo_separator
+from portage.elog import elog_process
+from portage.elog.messages import eerror
+
+def eapi_invalid(self, cpv, repo_name, settings,
+	eapi_var, eapi_parsed, eapi_lineno):
+
+	msg = []
+	msg.extend(textwrap.wrap(("EAPI assignment in ebuild '%s%s%s' does not"
+		" conform with PMS section 7.3.1:") %
+		(cpv, _repo_separator, repo_name), 70))
+
+	if not eapi_parsed:
+		# None means the assignment was not found, while an
+		# empty string indicates an (invalid) empty assingment.
+		msg.append(
+			"\tvalid EAPI assignment must"
+			" occur on or before line: %s" %
+			eapi_lineno)
+	else:
+		msg.append(("\tbash returned EAPI '%s' which does not match "
+			"assignment on line: %s") %
+			(eapi_var, eapi_lineno))
+
+	if 'parse-eapi-ebuild-head' in settings.features:
+		msg.extend(textwrap.wrap(("NOTE: This error will soon"
+			" become unconditionally fatal in a future version of Portage,"
+			" but at this time, it can by made non-fatal by setting"
+			" FEATURES=-parse-eapi-ebuild-head in"
+			" make.conf."), 70))
+	else:
+		msg.extend(textwrap.wrap(("NOTE: This error will soon"
+			" become unconditionally fatal in a future version of Portage."
+			" At the earliest opportunity, please enable"
+			" FEATURES=parse-eapi-ebuild-head in make.conf in order to"
+			" make this error fatal."), 70))
+
+	for line in msg:
+		eerror(line, phase="other", key=cpv)
+	elog_process(cpv, settings,
+		phasefilter=("other",))



             reply	other threads:[~2012-05-09 20:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 20:16 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-06-04 23:46 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/_emerge/ Zac Medico
2018-04-23  0:08 Zac Medico
2017-04-04  3:20 Zac Medico
2012-12-19  3:58 Arfrever Frehtes Taifersar Arahesis
2012-09-01 22:43 Zac Medico
2012-05-09 20:00 Zac Medico
2011-11-17 23:25 Zac Medico
2011-06-29  9:27 Zac Medico
2011-06-06 16:00 Arfrever Frehtes Taifersar Arahesis

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=1336594546.5958b9d406134a139cd66025eaf7bd650fb32b24.zmedico@gentoo \
    --to=zmedico@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