From 24f6f5abc052453964160dda6c6d37dcd907c0e9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 19 Feb 2007 08:46:42 +0000 Subject: [PATCH] For bug #167217, don't hardcode /usr/lib/portage. (trunk r5945) svn path=/main/branches/2.1.2/; revision=6016 --- bin/archive-conf | 3 ++- bin/chkcontents | 3 ++- bin/clean_locks | 3 ++- bin/dispatch-conf | 3 ++- bin/ebuild | 3 ++- bin/emaint | 3 ++- bin/emerge | 3 ++- bin/env-update | 3 ++- bin/fix-db.py | 3 ++- bin/fixpackages | 3 ++- bin/md5check.py | 3 ++- bin/pkgname | 3 ++- bin/portageq | 23 +++-------------------- bin/regenworld | 3 ++- bin/repoman | 3 ++- bin/xpak | 3 ++- 16 files changed, 33 insertions(+), 35 deletions(-) diff --git a/bin/archive-conf b/bin/archive-conf index bec5b3f0f..2fcecc646 100755 --- a/bin/archive-conf +++ b/bin/archive-conf @@ -14,7 +14,8 @@ import os, sys try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage import dispatch_conf diff --git a/bin/chkcontents b/bin/chkcontents index 8be51782d..fe108de06 100755 --- a/bin/chkcontents +++ b/bin/chkcontents @@ -12,7 +12,8 @@ import os.path, os, sys try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage def CONTENTScheck(path): diff --git a/bin/clean_locks b/bin/clean_locks index 71db0b8e2..57076b631 100755 --- a/bin/clean_locks +++ b/bin/clean_locks @@ -7,7 +7,8 @@ import os,sys,errno try: import portage_locks except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage_locks if not sys.argv[1:] or "--help" in sys.argv or "-h" in sys.argv: diff --git a/bin/dispatch-conf b/bin/dispatch-conf index c8e4d5678..348274802 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -21,7 +21,8 @@ import atexit, commands, os, re, shutil, stat, sys try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage import dispatch_conf diff --git a/bin/ebuild b/bin/ebuild index 33bc06c98..bb38911f7 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -24,7 +24,8 @@ os.environ["PORTAGE_CALLER"]="ebuild" try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage import portage_util, portage_const diff --git a/bin/emaint b/bin/emaint index 187ff773a..e86920a2f 100755 --- a/bin/emaint +++ b/bin/emaint @@ -8,7 +8,8 @@ import re try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage import portage_const, portage_exception diff --git a/bin/emerge b/bin/emerge index 20eb7265f..ae5bafb5e 100755 --- a/bin/emerge +++ b/bin/emerge @@ -26,7 +26,8 @@ os.environ["PORTAGE_LEGACY_GLOBALS"] = "false" try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage del os.environ["PORTAGE_LEGACY_GLOBALS"] from portage import digraph diff --git a/bin/env-update b/bin/env-update index 69daaca87..294876808 100755 --- a/bin/env-update +++ b/bin/env-update @@ -26,7 +26,8 @@ if len(sys.argv) > 1: try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage try: portage.env_update(makelinks) diff --git a/bin/fix-db.py b/bin/fix-db.py index e8bbad2ca..8292bc960 100755 --- a/bin/fix-db.py +++ b/bin/fix-db.py @@ -8,7 +8,8 @@ import os,sys,re try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage from stat import * diff --git a/bin/fixpackages b/bin/fixpackages index c03207d0a..388a9ad44 100755 --- a/bin/fixpackages +++ b/bin/fixpackages @@ -8,7 +8,8 @@ os.environ["PORTAGE_CALLER"]="fixpackages" try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage mysettings = portage.settings diff --git a/bin/md5check.py b/bin/md5check.py index 359a0bf00..8f1159e75 100755 --- a/bin/md5check.py +++ b/bin/md5check.py @@ -8,7 +8,8 @@ os.environ["FEATURES"]="mirror cvs" try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage import portage_util diff --git a/bin/pkgname b/bin/pkgname index ee4807744..4c0dd6c94 100755 --- a/bin/pkgname +++ b/bin/pkgname @@ -7,7 +7,8 @@ import sys, os try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage a=portage.pkgsplit(sys.argv[1]) diff --git a/bin/portageq b/bin/portageq index aa302555d..de2a24c12 100755 --- a/bin/portageq +++ b/bin/portageq @@ -270,24 +270,6 @@ def envvar(argv): else: print portage.settings[arg] -def get_repos(argv): - """ - Returns all repos with names (repo_name file) argv[0] = $ROOT - """ - if len(argv) < 1: - print "ERROR: insufficient parameters!" - sys.exit(2) - print " ".join(portage.db[argv[0]]["porttree"].dbapi.getRepositories()) - -def get_repo_path(argv): - """ + - Returns the path to the repo named argv[1], argv[0] = $ROOT - """ - if len(argv) < 2: - print "ERROR: insufficient parameters!" - sys.exit(2) - for arg in arvg[1:] - print portage.db[argv[0]]["porttree"].dbapi.getRepositoryPath(argv[1]) #----------------------------------------------------------------------------- # @@ -308,7 +290,7 @@ def usage(argv): # for name in globals().keys(): # Drop python stuff, modules, and our own support functions. - if (name in ("usage", "__doc__", "__name__", "main", "os", "portage", "sys", "__builtins__", "types", "string","exithandler")): + if (name in ("usage", "__doc__", "__name__", "main", "os", "portage", "sys", "__builtins__", "types", "string")): continue # Drop non-functions @@ -351,7 +333,8 @@ def main(): try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage if uses_root: sys.argv[2] = portage.root diff --git a/bin/regenworld b/bin/regenworld index 0f7de9a2a..ebac4a591 100755 --- a/bin/regenworld +++ b/bin/regenworld @@ -7,7 +7,8 @@ import sys, os try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage import re diff --git a/bin/repoman b/bin/repoman index daa19afdb..fa4bbcabd 100755 --- a/bin/repoman +++ b/bin/repoman @@ -26,7 +26,8 @@ os.environ["PORTAGE_LEGACY_GLOBALS"] = "false" try: import portage except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import portage del os.environ["PORTAGE_LEGACY_GLOBALS"] diff --git a/bin/xpak b/bin/xpak index 8dcbf145c..4fc1eb9fb 100755 --- a/bin/xpak +++ b/bin/xpak @@ -11,7 +11,8 @@ if len(sys.argv)!=3: try: import xpak except ImportError: - sys.path.insert(0, "/usr/lib/portage/pym") + from os import path as osp + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) import xpak xpak.xpak(sys.argv[1],sys.argv[2]) -- 2.26.2