diff options
author | neonene <53406459+neonene@users.noreply.github.com> | 2021-12-10 17:13:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 17:13:55 (GMT) |
commit | 3f398a77d37b5dfd51dabbc362d482a482fa885a (patch) | |
tree | 9ab6ad057291bc7ce12f9cf0286bd49556d5e407 /Lib | |
parent | 036bbb1d1b6156a1a72c40e9f907f302505085bc (diff) | |
download | cpython-3f398a77d37b5dfd51dabbc362d482a482fa885a.zip cpython-3f398a77d37b5dfd51dabbc362d482a482fa885a.tar.gz cpython-3f398a77d37b5dfd51dabbc362d482a482fa885a.tar.bz2 |
bpo-45582: Fix test_embed failure during a PGO build on Windows (GH-30014)
This defines VPATH differently in PGO instrumentation builds, to account for a different default output directory. It also adds sys._vpath on Windows to make the value available to sysconfig so that it can be used in tests.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/sysconfig.py | 1 | ||||
-rw-r--r-- | Lib/test/test_embed.py | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index da918b7..ef335c6 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -616,6 +616,7 @@ def get_config_vars(*args): if os.name == 'nt': _init_non_posix(_CONFIG_VARS) + _CONFIG_VARS['VPATH'] = sys._vpath if os.name == 'posix': _init_posix(_CONFIG_VARS) # For backward compatibility, see issue19555 diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 8012d80..8799524 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1300,11 +1300,16 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): def test_init_pybuilddir_win32(self): # Test path configuration with pybuilddir.txt configuration file - with self.tmpdir_with_python(r'PCbuild\arch') as tmpdir: + vpath = sysconfig.get_config_var("VPATH") + subdir = r'PCbuild\arch' + if os.path.normpath(vpath).count(os.sep) == 2: + subdir = os.path.join(subdir, 'instrumented') + + with self.tmpdir_with_python(subdir) as tmpdir: # The prefix is dirname(executable) + VPATH - prefix = os.path.normpath(os.path.join(tmpdir, r'..\..')) + prefix = os.path.normpath(os.path.join(tmpdir, vpath)) # The stdlib dir is dirname(executable) + VPATH + 'Lib' - stdlibdir = os.path.normpath(os.path.join(tmpdir, r'..\..\Lib')) + stdlibdir = os.path.normpath(os.path.join(tmpdir, vpath, 'Lib')) filename = os.path.join(tmpdir, 'pybuilddir.txt') with open(filename, "w", encoding="utf8") as fp: |