mirror of https://github.com/python/cpython
bpo-47103: Copy pgort140.dll into output directory when building PGInstrument on Windows (GH-32083)
This commit is contained in:
parent
35bcf9f3c1
commit
074da78802
|
@ -1206,20 +1206,11 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
||||||
|
|
||||||
if MS_WINDOWS:
|
if MS_WINDOWS:
|
||||||
# Copy pythonXY.dll (or pythonXY_d.dll)
|
# Copy pythonXY.dll (or pythonXY_d.dll)
|
||||||
ver = sys.version_info
|
import fnmatch
|
||||||
dll = f'python{ver.major}{ver.minor}'
|
exedir = os.path.dirname(self.test_exe)
|
||||||
dll3 = f'python{ver.major}'
|
for f in os.listdir(exedir):
|
||||||
if debug_build(sys.executable):
|
if fnmatch.fnmatch(f, '*.dll'):
|
||||||
dll += '_d'
|
shutil.copyfile(os.path.join(exedir, f), os.path.join(tmpdir, f))
|
||||||
dll3 += '_d'
|
|
||||||
dll += '.dll'
|
|
||||||
dll3 += '.dll'
|
|
||||||
dll = os.path.join(os.path.dirname(self.test_exe), dll)
|
|
||||||
dll3 = os.path.join(os.path.dirname(self.test_exe), dll3)
|
|
||||||
dll_copy = os.path.join(tmpdir, os.path.basename(dll))
|
|
||||||
dll3_copy = os.path.join(tmpdir, os.path.basename(dll3))
|
|
||||||
shutil.copyfile(dll, dll_copy)
|
|
||||||
shutil.copyfile(dll3, dll3_copy)
|
|
||||||
|
|
||||||
# Copy Python program
|
# Copy Python program
|
||||||
exec_copy = os.path.join(tmpdir, os.path.basename(self.test_exe))
|
exec_copy = os.path.join(tmpdir, os.path.basename(self.test_exe))
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Windows ``PGInstrument`` builds now copy a required DLL into the output
|
||||||
|
directory, making it easier to run the profile stage of a PGO build.
|
|
@ -133,9 +133,6 @@ set PYTHONPATH=$(PySourcePath)Lib
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="GeneratePythonBat" AfterTargets="AfterBuild">
|
<Target Name="GeneratePythonBat" AfterTargets="AfterBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'Win32'">@set PATH=%PATH%%3B$(VCInstallDir)bin</_PGOPath>
|
|
||||||
<_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'x64'">@set PATH=%PATH%%3B$(VCInstallDir)bin\amd64</_PGOPath>
|
|
||||||
<_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(VC_PGO_RunTime_Dir) != ''">@set PATH=%PATH%%3B$(VC_PGO_RunTime_Dir)</_PGOPath>
|
|
||||||
<_Content>@rem This script invokes the most recently built Python with all arguments
|
<_Content>@rem This script invokes the most recently built Python with all arguments
|
||||||
@rem passed through to the interpreter. This file is generated by the
|
@rem passed through to the interpreter. This file is generated by the
|
||||||
@rem build process and any changes *will* be thrown away by the next
|
@rem build process and any changes *will* be thrown away by the next
|
||||||
|
@ -145,11 +142,21 @@ set PYTHONPATH=$(PySourcePath)Lib
|
||||||
@echo Running $(Configuration)^|$(Platform) interpreter...
|
@echo Running $(Configuration)^|$(Platform) interpreter...
|
||||||
@setlocal
|
@setlocal
|
||||||
@set PYTHONHOME=$(PySourcePath)
|
@set PYTHONHOME=$(PySourcePath)
|
||||||
$(_PGOPath)
|
|
||||||
@"$(OutDir)python$(PyDebugExt).exe" %*
|
@"$(OutDir)python$(PyDebugExt).exe" %*
|
||||||
</_Content>
|
</_Content>
|
||||||
<_ExistingContent Condition="Exists('$(PySourcePath)python.bat')">$([System.IO.File]::ReadAllText('$(PySourcePath)python.bat'))</_ExistingContent>
|
<_ExistingContent Condition="Exists('$(PySourcePath)python.bat')">$([System.IO.File]::ReadAllText('$(PySourcePath)python.bat'))</_ExistingContent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<WriteLinesToFile File="$(PySourcePath)python.bat" Lines="$(_Content)" Overwrite="true" Condition="'$(_Content)' != '$(_ExistingContent)'" />
|
<WriteLinesToFile File="$(PySourcePath)python.bat" Lines="$(_Content)" Overwrite="true" Condition="'$(_Content)' != '$(_ExistingContent)'" />
|
||||||
</Target>
|
</Target>
|
||||||
|
<Target Name="CopyPGORT" AfterTargets="Link" Condition="$(Configuration) == 'PGInstrument'">
|
||||||
|
<ItemGroup>
|
||||||
|
<_PGORT Include="$(VCToolsInstallDir)bin\Hostx86\x86\pgort140.dll" Condition="$(Platform) == 'Win32'" />
|
||||||
|
<_PGORT Include="$(VCToolsInstallDir)bin\Hostx64\x64\pgort140.dll" Condition="$(Platform) == 'x64'" />
|
||||||
|
<_PGORT Include="$(VCToolsInstallDir)bin\arm64\pgort140.dll" Condition="$(Platform) == 'ARM64'" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Warning Text="Unable to locate pgort140.dll for $(Platform)." Condition="@(_PGORT) == '' or !Exists(@(_PGORT))" />
|
||||||
|
<Copy SourceFiles="@(_PGORT)" DestinationFolder="$(OutDir)">
|
||||||
|
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
|
||||||
|
</Copy>
|
||||||
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Reference in New Issue