public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Cc: python@gentoo.org, maksbotan@gentoo.org, sterkrig@myopera.com,
	"Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional.
Date: Sun, 20 Jan 2013 11:18:12 +0100	[thread overview]
Message-ID: <1358677094-20652-1-git-send-email-mgorny@gentoo.org> (raw)

If a particular package uses distutils part only conditionally
(e.g. with USE=python), you can do something like:

	DISTUTILS_OPTIONAL=1
	RDEPEND="python? ( ${PYTHON_DEPS} )"
	src_compile() { cd python; use python && distutils-r1_src_compile; }
	src_test() { cd python; use python && distutils-r1_src_test; }
	src_install() { cd python; use python && distutils-r1_src_install; }
---
 gx86/eclass/distutils-r1.eclass | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index 6a062ae..80734c5 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -54,18 +54,34 @@ case "${EAPI:-0}" in
 		;;
 esac
 
+# @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, distutils part in the ebuild will
+# be considered optional. No dependencies will be added and no phase
+# functions will be exported.
+#
+# If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies
+# for your package (using ${PYTHON_DEPS}) and to either call
+# distutils-r1 default phase functions or call the build system
+# manually.
+
 if [[ ! ${_DISTUTILS_R1} ]]; then
 
 inherit eutils multiprocessing python-r1
 
 fi
 
-EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
+	EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+fi
 
 if [[ ! ${_DISTUTILS_R1} ]]; then
 
-RDEPEND=${PYTHON_DEPS}
-DEPEND=${PYTHON_DEPS}
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
+	RDEPEND=${PYTHON_DEPS}
+	DEPEND=${PYTHON_DEPS}
+fi
 
 # @ECLASS-VARIABLE: DISTUTILS_JOBS
 # @DEFAULT_UNSET
-- 
1.8.1.1



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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-20 10:18 Michał Górny [this message]
2013-01-20 10:18 ` [gentoo-python] [PATCH 2/3] Wrap multijob_finish in a private function as well Michał Górny
2013-01-20 10:18 ` [gentoo-python] [PATCH 3/3] Support requesting single implementation only (python-single-r1) Michał Górny
2013-01-20 18:30   ` [gentoo-python] " Mike Gilbert
2013-01-20 18:39     ` Michał Górny
2013-01-20 18:47       ` Mike Gilbert
2013-01-20 18:19 ` [gentoo-python] Re: [PATCH 1/3] Support making distutils-r1 deps and phases optional Mike Gilbert
2013-01-21  6:17 ` Nikolaj Sjujskij

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=1358677094-20652-1-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    --cc=maksbotan@gentoo.org \
    --cc=python@gentoo.org \
    --cc=sterkrig@myopera.com \
    /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