public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional.
@ 2013-01-20 10:18 Michał Górny
  2013-01-20 10:18 ` [gentoo-python] [PATCH 2/3] Wrap multijob_finish in a private function as well Michał Górny
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Michał Górny @ 2013-01-20 10:18 UTC (permalink / raw
  To: gentoo-python; +Cc: python, maksbotan, sterkrig, Michał Górny

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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-01-21  6:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-20 10:18 [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional Michał Górny
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

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