From 50e9ed3ed0dc81b380f1a45096ef55ac4f7d029d Mon Sep 17 00:00:00 2001
From: david-sarah <david-sarah@jacaranda.org>
Date: Wed, 3 Nov 2010 18:20:27 -0700
Subject: [PATCH] misc/build_helpers/run_trial.py: minor refactoring -- make
 variable names consistent between run_trial.py and test_runner.py

---
 misc/build_helpers/run_trial.py | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/misc/build_helpers/run_trial.py b/misc/build_helpers/run_trial.py
index 39d5b35e..d448a00f 100644
--- a/misc/build_helpers/run_trial.py
+++ b/misc/build_helpers/run_trial.py
@@ -64,18 +64,18 @@ elif os.path.normcase(os.path.basename(srcdir)) == 'site-packages':
     if os.path.normcase(os.path.basename(srcdir)) == 'lib':
         srcdir = os.path.dirname(srcdir)
 
-srcdir = os.path.normcase(os.path.normpath(srcdir))
-if os.path.basename(srcdir) == 'src':
-    srcdir = os.path.dirname(srcdir)
+rootdir = os.path.normcase(os.path.normpath(srcdir))
+if os.path.basename(rootdir) == 'src':
+    rootdir = os.path.dirname(rootdir)
 
-cwd = os.path.normcase(os.path.normpath(os.getcwd()))
-if os.path.basename(cwd) == 'src':
-    cwd = os.path.dirname(cwd)
+root_from_cwd = os.path.normcase(os.path.normpath(os.getcwd()))
+if os.path.basename(root_from_cwd) == 'src':
+    root_from_cwd = os.path.dirname(root_from_cwd)
 
-same = (srcdir == cwd)
+same = (root_from_cwd == rootdir)
 if not same:
     try:
-        same = os.path.samefile(srcdir, cwd)
+        same = os.path.samefile(root_from_cwd, rootdir)
     except AttributeError, e:
         e  # hush pyflakes
 
@@ -83,12 +83,13 @@ if not same:
     msg = ("We seem to be testing the code at %r\n"
            "(according to the source filename %r),\n"
            "but expected to be testing the code at %r.\n"
-           % (srcdir, srcfile, cwd))
+           % (rootdir, srcfile, root_from_cwd))
+
+    root_from_cwdu = os.path.normcase(os.path.normpath(os.getcwdu()))
+    if os.path.basename(root_from_cwdu) == u'src':
+        root_from_cwdu = os.path.dirname(root_from_cwdu)
 
-    cwdu = os.path.normcase(os.path.normpath(os.getcwdu()))
-    if os.path.basename(cwdu) == u'src':
-        cwdu = os.path.dirname(cwdu)
-    if not isinstance(cwd, unicode) and cwd.decode(sys.getfilesystemencoding(), 'replace') != cwdu:
+    if not isinstance(root_from_cwd, unicode) and root_from_cwd.decode(sys.getfilesystemencoding(), 'replace') != root_from_cwdu:
         msg += ("However, this may be a false alarm because the current directory path\n"
                 "is not representable in the filesystem encoding. This script needs to be\n"
                 "run from the source directory to be tested, at a non-Unicode path.")
-- 
2.45.2