aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzyray <fuzzyray@gentoo.org>2010-04-08 21:13:07 +0000
committerfuzzyray <fuzzyray@gentoo.org>2010-04-08 21:13:07 +0000
commitf146d54860527cf1cfe8010d09730fd0a20fc690 (patch)
treece7a1c3921f2782d6180549c207bde14425f7e8e /pym/gentoolkit/eprefix.py
parenteuse: Fix query to get USE, bug 181309, thanks to Jean-Baptiste Rouault (diff)
downloadgentoolkit-f146d54860527cf1cfe8010d09730fd0a20fc690.tar.gz
gentoolkit-f146d54860527cf1cfe8010d09730fd0a20fc690.tar.bz2
gentoolkit-f146d54860527cf1cfe8010d09730fd0a20fc690.zip
Sync with genscripts rev 422, includes fixes to eclean and python additions for prefix
svn path=/trunk/gentoolkit/; revision=768
Diffstat (limited to 'pym/gentoolkit/eprefix.py')
-rw-r--r--pym/gentoolkit/eprefix.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/pym/gentoolkit/eprefix.py b/pym/gentoolkit/eprefix.py
new file mode 100644
index 0000000..9a04e4b
--- /dev/null
+++ b/pym/gentoolkit/eprefix.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+
+# Copyright 2003-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+
+#from __future__ import print_function
+
+"""Eprefix support module to set the EPREFIX variable
+used in all gentoolkit modules
+
+Example useage: from gentoolkit.eprefix import EPREFIX
+then in code add it to the filepath eg.:
+ exclude_file = "%s/etc/%s/%s.exclude" % (EPREFIX,__productname__ , action)
+
+"""
+
+import os
+
+
+EPREFIX = ''
+
+# the following code is used to set it when
+# non-installed code is being run
+if 'EPREFIX' in os.environ:
+ EPREFIX = os.environ['EPREFIX']
+else:
+ try:
+ import portage.const
+ EPREFIX = portage.BPREFIX
+ except AttributeError:
+ EPREFIX = ''
+
+#print("EPREFIX set to:", EPREFIX)