diff options
author | Steve Dower <steve.dower@python.org> | 2021-12-03 00:08:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 00:08:42 (GMT) |
commit | 99fcf1505218464c489d419d4500f126b6d6dc28 (patch) | |
tree | a9d607d854e943b3651248eadbe2f31f8c410021 /PCbuild/_freeze_module.vcxproj | |
parent | 9f2f7e42269db74a89fc8cd74d82a875787f01d7 (diff) | |
download | cpython-99fcf1505218464c489d419d4500f126b6d6dc28.zip cpython-99fcf1505218464c489d419d4500f126b6d6dc28.tar.gz cpython-99fcf1505218464c489d419d4500f126b6d6dc28.tar.bz2 |
bpo-45582: Port getpath[p].c to Python (GH-29041)
The getpath.py file is frozen at build time and executed as code over a namespace. It is never imported, nor is it meant to be importable or reusable. However, it should be easier to read, modify, and patch than the previous code.
This commit attempts to preserve every previously tested quirk, but these may be changed in the future to better align platforms.
Diffstat (limited to 'PCbuild/_freeze_module.vcxproj')
-rw-r--r-- | PCbuild/_freeze_module.vcxproj | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj index 54fef9c..7b2df4b 100644 --- a/PCbuild/_freeze_module.vcxproj +++ b/PCbuild/_freeze_module.vcxproj @@ -104,6 +104,7 @@ <ClCompile Include="..\Modules\faulthandler.c" /> <ClCompile Include="..\Modules\gcmodule.c" /> <ClCompile Include="..\Modules\getbuildinfo.c" /> + <ClCompile Include="..\Modules\getpath_noop.c" /> <ClCompile Include="..\Modules\posixmodule.c" /> <ClCompile Include="..\Modules\signalmodule.c" /> <ClCompile Include="..\Modules\_tracemalloc.c" /> @@ -168,7 +169,6 @@ <ClCompile Include="..\Parser\string_parser.c" /> <ClCompile Include="..\Parser\token.c" /> <ClCompile Include="..\Parser\tokenizer.c" /> - <ClCompile Include="..\PC\getpathp.c" /> <ClCompile Include="..\PC\invalid_parameter_handler.c" /> <ClCompile Include="..\PC\msvcrtmodule.c" /> <ClCompile Include="..\PC\winreg.c" /> @@ -374,9 +374,29 @@ </None> <!-- END frozen modules --> </ItemGroup> + <ItemGroup> + <!-- We manually freeze getpath.py rather than through freeze_modules --> + <GetPath Include="..\Modules\getpath.py"> + <ModName>getpath</ModName> + <IntFile>$(IntDir)getpath.g.h</IntFile> + <OutFile>$(PySourcePath)Modules\getpath.h</OutFile> + </GetPath> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> + <Target Name="_RebuildGetPath" AfterTargets="_RebuildFrozen" Condition="$(Configuration) != 'PGUpdate'"> + <Exec Command='"$(TargetPath)" "%(GetPath.ModName)" "%(GetPath.FullPath)" "%(GetPath.IntFile)"' /> + + <Copy SourceFiles="%(GetPath.IntFile)" + DestinationFiles="%(GetPath.OutFile)" + Condition="!Exists(%(GetPath.OutFile)) or (Exists(%(GetPath.IntFile)) and '$([System.IO.File]::ReadAllText(%(GetPath.OutFile)).Replace(`
`, `
`))' != '$([System.IO.File]::ReadAllText(%(GetPath.IntFile)).Replace(`
`, `
`))')"> + <Output TaskParameter="CopiedFiles" ItemName="_UpdatedGetPath" /> + </Copy> + + <Message Text="Updated files: @(_UpdatedGetPath->'%(Filename)%(Extension)',', ')" + Condition="'@(_UpdatedGetPath)' != ''" Importance="high" /> + </Target> <Target Name="_RebuildFrozen" AfterTargets="AfterBuild" Condition="$(Configuration) != 'PGUpdate'"> <Exec Command='"$(TargetPath)" "%(None.ModName)" "%(None.FullPath)" "%(None.DeepIntFile)"' /> |