From: Marius Mauch Date: Thu, 26 Oct 2006 13:49:45 +0000 (-0000) Subject: streamline portage pythonpath handling and add an override analog to how the bash... X-Git-Tag: v2.1.2~547 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d110e776d3c178444130b1361a50b00eac7c0275;p=portage.git streamline portage pythonpath handling and add an override analog to how the bash side does it svn path=/main/trunk/; revision=4822 --- diff --git a/NEWS b/NEWS index 4d203ab7b..64cd1da6a 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,8 @@ portage-2.1.2 order and detection of circular dependencies. * The world and system sets allow automatic update of all installed slots. * DEPEND atoms support SLOT dependencies of the form ${CATEGORY}/${PN}:${SLOT}. +* Development: Extend PORTAGE_PYM_PATH support to allow overriding the hardcoded + /usr/lib/portage/pym for development/testing purposes portage-2.1.1 ------------ diff --git a/bin/archive-conf b/bin/archive-conf index 24f0b626d..0417e97cc 100755 --- a/bin/archive-conf +++ b/bin/archive-conf @@ -11,7 +11,7 @@ # import os, sys, string -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage, dispatch_conf diff --git a/bin/chkcontents b/bin/chkcontents index bff77d0da..4523b6306 100755 --- a/bin/chkcontents +++ b/bin/chkcontents @@ -9,7 +9,7 @@ # the right files). import string, os.path, os, sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage def CONTENTScheck(path): diff --git a/bin/clean_locks b/bin/clean_locks index 0ecb62424..9c7e110ce 100755 --- a/bin/clean_locks +++ b/bin/clean_locks @@ -4,7 +4,7 @@ # $Id$ import os,sys,errno -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage_locks diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 960a38312..de937425c 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -15,7 +15,7 @@ from stat import * from random import * import atexit, commands, os, re, shutil, stat, string, sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage, dispatch_conf from portage_exec import find_binary diff --git a/bin/ebuild b/bin/ebuild index 773910929..0160fa039 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -21,7 +21,7 @@ if "merge" in pargs: os.environ["FEATURES"] = os.environ.get("FEATURES", "") + " -noauto" os.environ["PORTAGE_CALLER"]="ebuild" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage, portage_util, portage_const diff --git a/bin/emaint b/bin/emaint index fc1548527..016c64ea4 100755 --- a/bin/emaint +++ b/bin/emaint @@ -1,7 +1,7 @@ #!/usr/bin/python -O -import sys -sys.path.insert(0, "/usr/lib/portage/pym") +import sys, os +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) from optparse import OptionParser, OptionValueError import re diff --git a/bin/emerge b/bin/emerge index 8b69617ca..e98ea6211 100755 --- a/bin/emerge +++ b/bin/emerge @@ -21,7 +21,7 @@ except KeyboardInterrupt: sys.exit(1) import os, stat -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) os.environ["PORTAGE_LEGACY_GLOBALS"] = "false" import portage diff --git a/bin/env-update b/bin/env-update index 286996341..1026b1fc1 100755 --- a/bin/env-update +++ b/bin/env-update @@ -4,7 +4,7 @@ # $Id$ import os,sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) def usage(status): print "Usage: env-update [--no-ldconfig]" diff --git a/bin/fix-db.py b/bin/fix-db.py index 16a151502..fef1a4d44 100755 --- a/bin/fix-db.py +++ b/bin/fix-db.py @@ -4,7 +4,7 @@ # $Id$ import os,sys,re -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) from stat import * from output import * diff --git a/bin/fixpackages b/bin/fixpackages index 5eddb1c34..f9d09dec2 100755 --- a/bin/fixpackages +++ b/bin/fixpackages @@ -5,7 +5,7 @@ import os,sys os.environ["PORTAGE_CALLER"]="fixpackages" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage diff --git a/bin/md5check.py b/bin/md5check.py index 04a76ab43..98f3c8107 100755 --- a/bin/md5check.py +++ b/bin/md5check.py @@ -5,7 +5,7 @@ import os,sys,string os.environ["FEATURES"]="mirror cvs" -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage from threading import * diff --git a/bin/pkgname b/bin/pkgname index d1ba2f3dd..546b05d3c 100755 --- a/bin/pkgname +++ b/bin/pkgname @@ -3,8 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -import sys -sys.path = ["/usr/lib/portage/pym"]+sys.path +import sys, os +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage diff --git a/bin/portageq b/bin/portageq index ffbc13f62..0424647b7 100755 --- a/bin/portageq +++ b/bin/portageq @@ -20,7 +20,7 @@ except KeyboardInterrupt: sys.exit(1) import os -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import types,string diff --git a/bin/regenworld b/bin/regenworld index 7b14c2131..d5e28dd7f 100755 --- a/bin/regenworld +++ b/bin/regenworld @@ -3,9 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -import sys -sys.path.insert(0, "/usr/lib/portage/pym") -import os +import sys, os +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage, string, re __candidatematcher__ = re.compile("^[0-9]+: \\*\\*\\* emerge ") diff --git a/bin/repoman b/bin/repoman index ba4e62415..c05ae9e40 100755 --- a/bin/repoman +++ b/bin/repoman @@ -11,7 +11,7 @@ import errno, os, shutil, sys if not hasattr(__builtins__, "set"): from sets import Set as set exename=os.path.basename(sys.argv[0]) -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) version="1.2" allowed_filename_chars="a-zA-Z0-9._-+:" diff --git a/bin/xpak b/bin/xpak index 491024560..1a0743773 100755 --- a/bin/xpak +++ b/bin/xpak @@ -3,12 +3,12 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -import sys +import sys, os if len(sys.argv)!=3: print "xpak: expecting three arguments." sys.exit(1) -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import xpak xpak.xpak(sys.argv[1],sys.argv[2]) diff --git a/pym/dispatch_conf.py b/pym/dispatch_conf.py index 9e2c0bd2d..e4c512c45 100644 --- a/pym/dispatch_conf.py +++ b/pym/dispatch_conf.py @@ -10,7 +10,7 @@ from stat import * import os, sys, commands, shutil -sys.path = ["/usr/lib/portage/pym"]+sys.path +sys.path.insert(0, os.environ.get("PORTAGE_PYM_PATH", "/usr/lib/portage/pym")) import portage RCS_BRANCH = '1.1.1'