public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/tests/bin/, pym/portage/tests/, pym/portage/
@ 2013-03-21 20:31 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2013-03-21 20:31 UTC (permalink / raw
  To: gentoo-commits

commit:     84d405e6f79a04a6d2bfc4713dd80d48453d983a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 21 20:31:14 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Mar 21 20:31:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=84d405e6

Use realpath(__file__) to locate whole portage.

Use realpath(__file__) so that python module symlinks in site-packages
are followed back to the real location of the whole portage
installation.

---
 pym/portage/const.py               |    4 +++-
 pym/portage/tests/bin/setup_env.py |   12 +++++-------
 pym/portage/tests/runTests         |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/pym/portage/const.py b/pym/portage/const.py
index fdd33e6..93556a0 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -58,7 +58,9 @@ DEPCACHE_PATH            = "/var/cache/edb/dep"
 GLOBAL_CONFIG_PATH       = "/usr/share/portage/config"
 
 # these variables are not used with target_root or config_root
-PORTAGE_BASE_PATH        = os.path.join(os.sep, os.sep.join(__file__.split(os.sep)[:-3]))
+# NOTE: Use realpath(__file__) so that python module symlinks in site-packages
+# are followed back to the real location of the whole portage installation.
+PORTAGE_BASE_PATH        = os.path.join(os.sep, os.sep.join(os.path.realpath(__file__).split(os.sep)[:-3]))
 PORTAGE_BIN_PATH         = PORTAGE_BASE_PATH + "/bin"
 PORTAGE_PYM_PATH         = PORTAGE_BASE_PATH + "/pym"
 LOCALE_DATA_PATH         = PORTAGE_BASE_PATH + "/locale"  # FIXME: not used

diff --git a/pym/portage/tests/bin/setup_env.py b/pym/portage/tests/bin/setup_env.py
index 1f8554e..42a0e56 100644
--- a/pym/portage/tests/bin/setup_env.py
+++ b/pym/portage/tests/bin/setup_env.py
@@ -1,19 +1,17 @@
 # setup_env.py -- Make sure bin subdir has sane env for testing
-# Copyright 2007-2011 Gentoo Foundation
+# Copyright 2007-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import tempfile
 
 from portage import os
 from portage import shutil
+from portage.const import PORTAGE_BIN_PATH
+from portage.const import PORTAGE_PYM_PATH
 from portage.tests import TestCase
 from portage.process import spawn
 
-basepath = os.path.join(os.path.dirname(os.path.dirname(
-	os.path.abspath(__file__))),
-	"..", "..", "..")
-bindir = os.path.join(basepath, "bin")
-pymdir = os.path.join(basepath, "pym")
+bindir = PORTAGE_BIN_PATH
 basedir = None
 env = None
 
@@ -37,7 +35,7 @@ def binTestsInit():
 	env["PF"] = "portage-tests-0.09-r1"
 	env["PATH"] = bindir + ":" + os.environ["PATH"]
 	env["PORTAGE_BIN_PATH"] = bindir
-	env["PORTAGE_PYM_PATH"] = pymdir
+	env["PORTAGE_PYM_PATH"] = PORTAGE_PYM_PATH
 	env["PORTAGE_INST_UID"] = str(os.getuid())
 	env["PORTAGE_INST_GID"] = str(os.getgid())
 	env["DESTTREE"] = "/usr"

diff --git a/pym/portage/tests/runTests b/pym/portage/tests/runTests
index b006969..60bcf31 100755
--- a/pym/portage/tests/runTests
+++ b/pym/portage/tests/runTests
@@ -29,7 +29,7 @@ os.environ["PORTAGE_GRPNAME"] = grp.getgrgid(os.getgid()).gr_name
 
 # Insert our parent dir so we can do shiny import "tests"
 # This line courtesy of Marienz and Pkgcore ;)
-sys.path.insert(0, osp.dirname(osp.dirname(osp.dirname(osp.abspath(__file__)))))
+sys.path.insert(0, osp.dirname(osp.dirname(osp.dirname(osp.realpath(__file__)))))
 
 import portage
 portage._internal_caller = True


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-21 20:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-21 20:31 [gentoo-commits] proj/portage:master commit in: pym/portage/tests/bin/, pym/portage/tests/, pym/portage/ Zac Medico

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