FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-45582: Fix test_embed failure during a PGO build on Windows by neonene · Pull Request #30014 · python/cpython · GitHub

Repository navigation

1 change: 1 addition & 0 deletions Lib/sysconfig.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions Lib/test/test_embed.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1300,11 +1300,16 @@ def test_init_pybuilddir(self):
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:
Expand Down
2 changes: 1 addition & 1 deletion Modules/getpath.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@

elif os_name == 'nt':
BUILDDIR_TXT = 'pybuilddir.txt'
BUILD_LANDMARK = r'..\..\Modules\Setup.local'
BUILD_LANDMARK = f'{VPATH}\\Modules\\Setup.local'
DEFAULT_PROGRAM_NAME = f'python'
STDLIB_SUBDIR = 'Lib'
STDLIB_LANDMARKS = [f'{STDLIB_SUBDIR}\\os.py', f'{STDLIB_SUBDIR}\\os.pyc']
Expand Down
4 changes: 3 additions & 1 deletion PCbuild/_freeze_module.vcxproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@
<ClCompile Include="..\Python\structmember.c" />
<ClCompile Include="..\Python\suggestions.c" />
<ClCompile Include="..\Python\symtable.c" />
<ClCompile Include="..\Python\sysmodule.c" />
<ClCompile Include="..\Python\sysmodule.c">
<PreprocessorDefinitions>VPATH="$(PyVPath)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\Python\thread.c" />
<ClCompile Include="..\Python\traceback.c" />
</ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions PCbuild/python.props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
<BuildPath Condition="$(Configuration) == 'PGInstrument'">$(BuildPath)instrumented\</BuildPath>

<!-- VPATH definition (escaped) -->
<PyVPath Condition="$(Configuration) != 'PGInstrument'">..\\..</PyVPath>
<PyVPath Condition="$(Configuration) == 'PGInstrument'">..\\..\\..</PyVPath>

<!-- Directories of external projects. tcltk is handled in tcltk.props -->
<ExternalsDir>$(EXTERNALS_DIR)</ExternalsDir>
<ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>
Expand Down
6 changes: 4 additions & 2 deletions PCbuild/pythoncore.vcxproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
PREFIX=NULL;
EXEC_PREFIX=NULL;
VERSION=NULL;
VPATH="..\\..";
VPATH="$(PyVPath)";
PYDEBUGEXT="$(PyDebugExt)";
PLATLIBDIR="DLLs";
%(PreprocessorDefinitions)
Expand Down Expand Up @@ -519,7 +519,9 @@
<ClCompile Include="..\Python\suggestions.c" />
<ClCompile Include="..\Python\structmember.c" />
<ClCompile Include="..\Python\symtable.c" />
<ClCompile Include="..\Python\sysmodule.c" />
<ClCompile Include="..\Python\sysmodule.c">
<PreprocessorDefinitions>VPATH="$(PyVPath)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\Python\thread.c" />
<ClCompile Include="..\Python\traceback.c" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions Python/sysmodule.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2823,6 +2823,8 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict)
goto type_init_failed;
}
}

SET_SYS_FROM_STRING("_vpath", VPATH);
#endif

/* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */
Expand Down

Back | FazBrowse Home | New Git URL