From: david-sarah Date: Sun, 31 Oct 2010 15:36:13 +0000 (-0700) Subject: misc/build_helpers/run_trial.py: fix false positive on directory check that can occur... X-Git-Tag: trac-4800~10 X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/status?a=commitdiff_plain;h=74996ffe46553209d8a66d97c99b28be9e8d4056;p=tahoe-lafs%2Ftahoe-lafs.git misc/build_helpers/run_trial.py: fix false positive on directory check that can occur when running run_trial from test-with-fake-pkg manually. --- diff --git a/misc/build_helpers/run_trial.py b/misc/build_helpers/run_trial.py index 27523206..c8efc214 100644 --- a/misc/build_helpers/run_trial.py +++ b/misc/build_helpers/run_trial.py @@ -65,9 +65,11 @@ elif os.path.normcase(os.path.basename(srcdir)) == 'site-packages': srcdir = os.path.dirname(srcdir) srcdir = os.path.normcase(os.path.normpath(srcdir)) -cwd = os.path.normcase(os.path.normpath(os.getcwd())) +if os.path.basename(srcdir) == 'src': + srcdir = os.path.dirname(srcdir) -if os.path.normcase(os.path.basename(cwd)) == 'src': +cwd = os.path.normcase(os.path.normpath(os.getcwd())) +if os.path.basename(cwd) == 'src': cwd = os.path.dirname(cwd) same = (srcdir == cwd) @@ -82,8 +84,11 @@ if not same: "(according to the source filename %r),\n" "but expected to be testing the code at %r.\n" % (srcdir, srcfile, cwd)) - if (not isinstance(cwd, unicode) and - cwd.decode(sys.getfilesystemencoding(), 'replace') != os.path.normcase(os.path.normpath(os.getcwdu()))): + + 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): 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.")