From 637637021a52d083f47dfdd6dd0cc16e31696409 Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Thu, 11 Mar 2010 01:50:48 +0000 Subject: [PATCH] Revert r78830: realpath() should really be applied to sys.executable. --- Lib/sysconfig.py | 5 ++--- Lib/test/test_subprocess.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index 2b14bfe032d..69264d2e481 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -84,8 +84,7 @@ _PREFIX = os.path.normpath(sys.prefix) _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) _CONFIG_VARS = None _USER_BASE = None -# Note: sys.executable can be '' or even a directory, until #7774 is fixed. -_PROJECT_BASE = realpath(os.path.dirname(sys.executable)) +_PROJECT_BASE = os.path.dirname(realpath(sys.executable)) if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower(): _PROJECT_BASE = realpath(os.path.join(_PROJECT_BASE, pardir)) @@ -295,7 +294,7 @@ def _init_non_posix(vars): vars['SO'] = '.pyd' vars['EXE'] = '.exe' vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT - vars['BINDIR'] = realpath(os.path.dirname(sys.executable)) + vars['BINDIR'] = os.path.dirname(realpath(sys.executable)) # # public APIs diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 365ac91279a..dc57c46b456 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -135,7 +135,7 @@ class ProcessTestCase(unittest.TestCase): self.assertEqual(p.stderr, None) def test_executable_with_cwd(self): - python_dir = os.path.realpath(os.path.dirname(sys.executable)) + python_dir = os.path.dirname(os.path.realpath(sys.executable)) p = subprocess.Popen(["somethingyoudonthave", "-c", "import sys; sys.exit(47)"], executable=sys.executable, cwd=python_dir)