public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Gilbert <floppym@gentoo.org>
To: gentoo-python@lists.gentoo.org
Subject: [gentoo-python] [PATCH] python.eclass: Avoid multiple inclusion
Date: Thu, 29 Dec 2011 16:18:04 -0500	[thread overview]
Message-ID: <4EFCD90C.3010309@gentoo.org> (raw)


[-- 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 --]

                 reply	other threads:[~2011-12-29 21:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4EFCD90C.3010309@gentoo.org \
    --to=floppym@gentoo.org \
    --cc=gentoo-python@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