From 85e102a2b090dd693d0801ae2edb9660cfa0f281 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 4 Feb 2019 17:15:13 -0800 Subject: bpo-35299: Fixed sysconfig and distutils during PGO profiling (GH-11744) --- Lib/sysconfig.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Lib/sysconfig.py') diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index e0f9c18531..cc8c7962b1 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -125,9 +125,16 @@ def _is_python_source_dir(d): return False _sys_home = getattr(sys, '_home', None) -if (_sys_home and os.name == 'nt' and - _sys_home.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))): - _sys_home = os.path.dirname(os.path.dirname(_sys_home)) + +if os.name == 'nt': + def _fix_pcbuild(d): + if d and os.path.normcase(d).startswith( + os.path.normcase(os.path.join(_PREFIX, "PCbuild"))): + return _PREFIX + return d + _PROJECT_BASE = _fix_pcbuild(_PROJECT_BASE) + _sys_home = _fix_pcbuild(_sys_home) + def is_python_build(check_home=False): if check_home and _sys_home: return _is_python_source_dir(_sys_home) -- cgit v1.2.1