public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH] Introduce run_in_build_dir() as requested in a few ebuilds.
@ 2013-01-26 11:28 Michał Górny
  2013-01-26 15:43 ` [gentoo-python] " Mike Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2013-01-26 11:28 UTC (permalink / raw
  To: gentoo-python; +Cc: python, Michał Górny

As people wanted to make a horrible monster out of this if added
to eutils, just add it here.
---
 gx86/eclass/python-r1.eclass | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 63dc556..27653af 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -681,5 +681,24 @@ python_replicate_script() {
 	done
 }
 
+# @FUNCTION: run_in_build_dir
+# @USAGE: <argv>...
+# @DESCRIPTION:
+# Run the given command in the directory pointed by BUILD_DIR.
+run_in_build_dir() {
+	debug-print-function ${FUNCNAME} "${@}"
+	local ret
+
+	[[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified."
+	[[ ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set."
+
+	pushd "${BUILD_DIR}" &>/dev/null || die
+	"${@}"
+	ret=${?}
+	popd &>/dev/null || die
+
+	return ${ret}
+}
+
 _PYTHON_R1=1
 fi
-- 
1.8.1.1



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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-26 11:28 [gentoo-python] [PATCH] Introduce run_in_build_dir() as requested in a few ebuilds Michał Górny
2013-01-26 15:43 ` [gentoo-python] " Mike Gilbert
2013-01-26 17:08   ` Michał Górny

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