public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH] python.eclass: Avoid multiple inclusion
@ 2011-12-29 21:18 Mike Gilbert
  0 siblings, 0 replies; only message in thread
From: Mike Gilbert @ 2011-12-29 21:18 UTC (permalink / raw
  To: gentoo-python


[-- Attachment #1.1: Type: text/plain, Size: 661 bytes --]

Mike's doing it in autotools.eclass, so let's do it too.

This will aid in debugging code in global scope and prevent duplicate
dependency atoms from being generated. Also, per vapier[1], it could
have some performance enhancing qualities.

The distutils part avoids sourcing python.eclass if distutils is
inherited after python. We can add similar blocks to other eclass
consumers of python.eclass.

I think it's a good idea, and you should to.

Please see attached patch. Please let me know you have some objection;
otherwise I will commit on Sunday, Jan 1.

[1]
http://archives.gentoo.org/gentoo-dev/msg_18dab542c1c59873f8cb68c96cdf6619.xml

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: python-eclass-multiple-inclusion.patch --]
[-- Type: text/x-patch; name="python-eclass-multiple-inclusion.patch", Size: 1522 bytes --]

Index: distutils.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v
retrieving revision 1.80
diff -u -B -r1.80 distutils.eclass
--- distutils.eclass	12 Apr 2011 18:49:03 -0000	1.80
+++ distutils.eclass	29 Dec 2011 21:12:19 -0000
@@ -9,7 +9,11 @@
 # @DESCRIPTION:
 # The distutils eclass defines phase functions for packages with build systems using Distutils.
 
-inherit multilib python
+if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
+	inherit python
+fi
+
+inherit multilib
 
 case "${EAPI:-0}" in
 	0|1)
Index: python.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v
retrieving revision 1.143
diff -u -B -r1.143 python.eclass
--- python.eclass	19 Dec 2011 01:29:57 -0000	1.143
+++ python.eclass	29 Dec 2011 21:12:21 -0000
@@ -9,6 +9,9 @@
 # @DESCRIPTION:
 # The python eclass contains miscellaneous, useful functions for Python packages.
 
+if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
+_PYTHON_ECLASS_INHERITED="1"
+
 inherit multilib
 
 if ! has "${EAPI:-0}" 0 1 2 3 4; then
@@ -3114,3 +3117,5 @@
 # ================================================================================================
 # ===================================== DEPRECATED FUNCTIONS =====================================
 # ================================================================================================
+
+fi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-29 21:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 21:18 [gentoo-python] [PATCH] python.eclass: Avoid multiple inclusion Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox