Author: andrew.lawre...@siemens.com Branch: windowsinstaller Changeset: r95800:c9a11ed5ae5d Date: 2018-12-24 08:55 +0000 http://bitbucket.org/pypy/pypy/changeset/c9a11ed5ae5d/
Log: Started merging cpython scripts diff --git a/pypy/tool/release/windowsinstaller/README b/pypy/tool/release/windowsinstaller/README new file mode 100644 --- /dev/null +++ b/pypy/tool/release/windowsinstaller/README @@ -0,0 +1,8 @@ +Prerequisites: + Visual Studio 2017 + Wix 3.11.1 + Wix VSExtension for VS 2017 + +Steps: + 1. Translate the interpretter from the \pypy\goal folder. + 2. Run buildrelease.bat from the visual studio command line. \ No newline at end of file diff --git a/pypy/tool/release/windowsinstaller/buildrelease.bat b/pypy/tool/release/windowsinstaller/buildrelease.bat new file mode 100644 --- /dev/null +++ b/pypy/tool/release/windowsinstaller/buildrelease.bat @@ -0,0 +1,44 @@ +@setlocal +@echo off + + +set D=%~dp0 +set PCBUILD=%D%..\..\..\..\PCbuild\ +if "%Py_OutDir%"=="" set Py_OutDir=%PCBUILD% +set EXTERNALS=%D%..\..\externals\windows-installer\ + +set BUILDX86= +set BUILDX64= +set TARGET=Rebuild +set TESTTARGETDIR= +set PGO=-m test -q --pgo +set BUILDNUGET=1 +set BUILDZIP=1 + + +:CheckOpts +if "%1" EQU "-h" goto Help +if "%1" EQU "-o" (set OUTDIR=%~2) && shift && shift && goto CheckOpts +if "%1" EQU "--out" (set OUTDIR=%~2) && shift && shift && goto CheckOpts + + +if "%1" NEQ "" echo Invalid option: "%1" && exit /B 1 + +if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) + +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) + + +%MSBUILD% "%D%bundle\releaselocal.wixproj" /t:Rebuild /p:RebuildAll=true +if errorlevel 1 exit /B + +exit /B 0 + +:Help +echo buildrelease.bat [--out DIR] +echo [-h] +echo. +echo --out (-o) Specify an additional output directory for installers +echo -h Display this help information +echo. diff --git a/pypy/tool/release/windowsinstaller/msi.props b/pypy/tool/release/windowsinstaller/msi.props new file mode 100644 --- /dev/null +++ b/pypy/tool/release/windowsinstaller/msi.props @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="ReleaseUri"> + <PropertyGroup> + <TargetName>$(OutputName)</TargetName> + <DefineSolutionProperties>false</DefineSolutionProperties> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> + <SuppressIces>$(SuppressIces);ICE03;ICE57;ICE61</SuppressIces> + <CompilerSuppressSpecificWarnings>1026</CompilerSuppressSpecificWarnings> + <BuildForRelease Condition="'$(BuildForRelease)' == ''">false</BuildForRelease> + <SignOutput Condition="'$(SigningCertificate)' != ''">true</SignOutput> + <Configuration Condition="'$(Configuration)' == ''">Release</Configuration> + <Platform Condition="'$(Platform)' == ''">x86</Platform> + <InstallScope Condition="'$(InstallScope)' != 'perMachine'">perUser</InstallScope> + <_MakeCatCommand Condition="'$(_MakeCatCommand)' == ''">makecat</_MakeCatCommand> + </PropertyGroup> + + <Import Project="wix.props" /> + <Import Project="..\..\..\..\PCbuild\tcltk.props" /> + + <PropertyGroup> + <!-- + This URI is used to generate the various GUIDs used by the installer. + Installers built with the same URI will upgrade each other or block + when attempting to downgrade. + + By default, this is the local computer name, which will produce + installers that do not interfere with other installers. Products + that intend to bundle Python should rebuild these modules with their + own URI to avoid conflicting with the official releases. + + The official releases use "http://www.python.org/$(ArchName)" + + This is not the same as the DownloadUrl property used in the bundle + projects. + --> + <ReleaseUri Condition="'$(ReleaseUri)' == ''">$(ComputerName)/$(ArchName)/</ReleaseUri> + <ReleaseUri Condition="!$(ReleaseUri.EndsWith(`/`))">$(ReleaseUri)/</ReleaseUri> + </PropertyGroup> + + + <ItemGroup> + <Compile Include="$(MSBuildThisFileDirectory)common.wxs" /> + <WxlTemplate Include="$(MSBuildThisFileDirectory)\*.wxl_template" Condition="$(IgnoreCommonWxlTemplates) != 'true'" /> + <WixExtension Include="WixUtilExtension"> + <HintPath>WixUtilExtension</HintPath> + <Name>WixUtilExtension</Name> + </WixExtension> + </ItemGroup> + + <PropertyGroup> + <IntermediateOutputPath>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\msi_$(OutputName)</IntermediateOutputPath> + <IntermediateOutputPath Condition="'$(OutputSuffix)' != ''">$(IntermediateOutputPath)_$(OutputSuffix)</IntermediateOutputPath> + <OutputPath Condition="'$(OutputPath)' == ''">$(BuildPath)</OutputPath> + <OutputPath Condition="!HasTrailingSlash($(OutputPath))">$(OutputPath)\</OutputPath> + <OutDir>$(OutputPath)</OutDir> + <ReuseCabinetCache>true</ReuseCabinetCache> + <CRTRedist Condition="'$(CRTRedist)' == ''">$(ExternalsDir)\windows-installer\redist-1\$(Platform)</CRTRedist> + <CRTRedist>$([System.IO.Path]::GetFullPath($(CRTRedist)))</CRTRedist> + <DocFilename>pypy$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm</DocFilename> + + <InstallerVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(Field3Value).0</InstallerVersion> + </PropertyGroup> + + <PropertyGroup Condition="!$(BuildForRelease)"> + <RevisionNumber Condition="'$(RevisionNumber)' == ''">$([System.Math]::Floor($([System.DateTime]::Now.Subtract($([System.DateTime]::new(2001, 1, 1))).TotalDays)))</RevisionNumber> + <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)dev$(RevisionNumber)</PythonVersion> + <InstallerVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(RevisionNumber).0</InstallerVersion> + </PropertyGroup> + + <PropertyGroup> + <Bitness>32-bit</Bitness> + <Bitness Condition="$(Platform) == 'x64'">64-bit</Bitness> + <PlatformArchitecture>32bit</PlatformArchitecture> + <PlatformArchitecture Condition="$(Platform) == 'x64'">64bit</PlatformArchitecture> + <DefineConstants> + $(DefineConstants); + Version=$(InstallerVersion); + ShortVersion=$(MajorVersionNumber).$(MinorVersionNumber); + LongVersion=$(PythonVersion); + MajorVersionNumber=$(MajorVersionNumber); + MinorVersionNumber=$(MinorVersionNumber); + UpgradeMinimumVersion=$(MajorVersionNumber).$(MinorVersionNumber).0.0; + NextMajorVersionNumber=$(MajorVersionNumber).$([msbuild]::Add($(MinorVersionNumber), 1)).0.0; + Bitness=$(Bitness); + PlatformArchitecture=$(PlatformArchitecture); + PyDebugExt=$(PyDebugExt); + PyArchExt=$(PyArchExt); + PyTestExt=$(PyTestExt); + OptionalFeatureName=$(OutputName); + </DefineConstants> + <DefineConstants Condition="'$(CRTRedist)' != ''"> + $(DefineConstants);CRTRedist=$(CRTRedist); + </DefineConstants> + <DefineConstants Condition="$(Platform) != 'x64'"> + $(DefineConstants);Suffix32=-32;ssltag=-1_1; + </DefineConstants> + <DefineConstants Condition="$(Platform) == 'x64'"> + $(DefineConstants);Suffix32=;ssltag=-1_1-x64; + </DefineConstants> + </PropertyGroup> + + <ItemDefinitionGroup> + <InstallFiles> + <Group>generated_filelist</Group> + <Condition></Condition> + <DiskId></DiskId> + <IncludeInCat>false</IncludeInCat> + </InstallFiles> + <LinkerBindInputPaths> + <Visible>false</Visible> + </LinkerBindInputPaths> + </ItemDefinitionGroup> + <ItemGroup> + <LinkerBindInputPaths Include="$(PGOBuildPath);$(BuildPath)"> + <BindName></BindName> + </LinkerBindInputPaths> + <LinkerBindInputPaths Include="$(PySourcePath)Doc\build\htmlhelp"> + <BindName></BindName> + </LinkerBindInputPaths> + <LinkerBindInputPaths Include="$(PySourcePath)"> + <BindName>src</BindName> + </LinkerBindInputPaths> + <LinkerBindInputPaths Include="$(tcltkDir)"> + <BindName>tcltk</BindName> + </LinkerBindInputPaths> + <LinkerBindInputPaths Include="$(CRTRedist)"> + <BindName>redist</BindName> + </LinkerBindInputPaths> + <LinkerBindInputPaths Include="$(BuildPath32)"> + <BindName>build32</BindName> + </LinkerBindInputPaths> + <LinkerBindInputPaths Include="$(BuildPath64)"> + <BindName>build64</BindName> + </LinkerBindInputPaths> + </ItemGroup> + + <Target Name="_ValidateMsiProps" BeforeTargets="PrepareForBuild"> + <Error Text="Platform '$(Platform)' is not supported. Use 'x86' or 'x64'." Condition="$(Platform) != 'x86' and $(Platform) != 'x64'" /> + </Target> + + <ItemGroup> + <_Uuid Include="CoreUpgradeCode"> + <Uri>upgradecode</Uri> + </_Uuid> + <_Uuid Include="UpgradeCode"> + <Uri>upgradecode/$(OutputName)</Uri> + </_Uuid> + <_Uuid Include="InstallDirectoryGuidSeed"> + <Uri>installdirectoryseed</Uri> + </_Uuid> + <_Uuid Include="PythonExeComponentGuid"> + <Uri>pypy.exe</Uri> + </_Uuid> + <_Uuid Include="PythonwExeComponentGuid"> + <Uri>pypyw.exe</Uri> + </_Uuid> + <_Uuid Include="RemoveLib2to3PickleComponentGuid"> + <Uri>lib2to3/pickles</Uri> + </_Uuid> + <_Uuid Include="CommonPythonRegComponentGuid"> + <Uri>registry</Uri> + </_Uuid> + <_Uuid Include="PythonRegComponentGuid"> + <Uri>registry/$(OutputName)</Uri> + </_Uuid> + </ItemGroup> + <Target Name="_GenerateGuids" AfterTargets="PrepareForBuild" Condition="$(TargetName) != 'launcher'"> + <PropertyGroup> + <_Uuids>@(_Uuid->'("%(Identity)", "$(MajorVersionNumber).$(MinorVersionNumber)/%(Uri)")',',')</_Uuids> + <_GenerateCommand>import uuid; print('\n'.join('{}={}'.format(i, uuid.uuid5(uuid.UUID('c8d9733e-a70c-43ff-ab0c-e26456f11083'), '$(ReleaseUri.Replace(`{arch}`, `$(ArchName)`))' + j)) for i,j in [$(_Uuids.Replace(`"`,`'`))]))</_GenerateCommand> + </PropertyGroup> + + <Exec Command='"$(PythonExe)" -c "$(_GenerateCommand)" > "$(IntermediateOutputPath)$(OutputName)guids.txt"' + WorkingDirectory="$(MSBuildThisFileDirectory)" + IgnoreExitCode="false" /> + + <ReadLinesFromFile File="$(IntermediateOutputPath)$(OutputName)guids.txt"> + <Output TaskParameter="Lines" ItemName="_UuidValue" /> + </ReadLinesFromFile> + + <PropertyGroup> + <DefineConstants>$(DefineConstants);@(_UuidValue,';');</DefineConstants> + </PropertyGroup> + </Target> +</Project> \ No newline at end of file diff --git a/pypy/tool/release/windowsinstaller/msi.targets b/pypy/tool/release/windowsinstaller/msi.targets new file mode 100644 --- /dev/null +++ b/pypy/tool/release/windowsinstaller/msi.targets @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + + <Target Name="ProcessInstallFiles" AfterTargets="PrepareForBuild" Condition="@(InstallFiles) != ''"> + <PropertyGroup> + <_FileListTarget>$(IntermediateOutputPath)$(MSBuildProjectName).g.csv</_FileListTarget> + <_InstallFilesTarget>$(IntermediateOutputPath)$(MSBuildProjectName).g.wxs</_InstallFilesTarget> + </PropertyGroup> + + <ItemGroup> + <InstallFiles> + <_Source>%(Source)$([msbuild]::MakeRelative(%(SourceBase), %(FullPath)))</_Source> + <_Target>%(Target_)$([msbuild]::MakeRelative(%(TargetBase), %(FullPath)))</_Target> + </InstallFiles> + + <_CatalogFiles Include="@(InstallFiles)" Condition="%(InstallFiles.IncludeInCat) and ''!=$([System.IO.File]::ReadAllText(%(InstallFiles.FullPath)))" /> + </ItemGroup> + + <WriteLinesToFile File="$(_FileListTarget)" Lines="@(InstallFiles->'"%(_Source)","%(_Target)","%(Group)","%(DiskId)","%(Condition)"')" Overwrite="true" /> + <Exec Command='"$(PythonExe)" csv_to_wxs.py "$(_FileListTarget)" "$(_InstallFilesTarget)"' + WorkingDirectory="$(MSBuildThisFileDirectory)" /> + + <ItemGroup> + <FileWrites Include="$(_FileListTarget);$(_InstallFilesTarget)" /> + <Compile Include="$(_InstallFilesTarget)" /> + </ItemGroup> + </Target> + + <Target Name="GenerateCatalog" AfterTargets="ProcessInstallFiles" Condition="'@(_CatalogFiles)' != ''"> + <PropertyGroup> + <_CatFileSourceTarget>$(IntermediateOutputPath)$(MSBuildProjectName).cdf</_CatFileSourceTarget> + <_CatFileTarget>$(IntermediateOutputPath)python_$(MSBuildProjectName).cat</_CatFileTarget> + <_CatFile>[CatalogHeader] +Name=$([System.IO.Path]::GetFileName($(_CatFileTarget))) +ResultDir=$([System.IO.Path]::GetDirectoryName($(_CatFileTarget))) +PublicVersion=1 +CatalogVersion=2 +HashAlgorithms=SHA256 +PageHashes=false +EncodingType= + +[CatalogFiles] +@(_CatalogFiles->'<HASH>%(Filename)%(Extension)=%(FullPath)',' +') +</_CatFile> + </PropertyGroup> + + <WriteLinesToFile File="$(_CatFileSourceTarget)" Lines="$(_CatFile)" Overwrite="true" /> + <Exec Command='$(_MakeCatCommand) "$(_CatFileSourceTarget)"' WorkingDirectory="$(MSBuildThisFileDirectory)" /> + <Exec Command='$(_SignCommand) "$(_CatFileTarget)"' WorkingDirectory="$(MSBuildThisFileDirectory)" + Condition="Exists($(_CatFileTarget)) and '$(_SignCommand)' != ''" /> + + <ItemGroup> + <FileWrites Include="$(_CatFileSourceTarget);$(_CatFileTarget)" /> + </ItemGroup> + </Target> + + <Target Name="_TransformWxlTemplates" AfterTargets="PrepareForBuild" Inputs="@(WxlTemplate);$(PySourcePath)include\patchlevel.h" Outputs="$(IntermediateOutputPath)%(Filename).wxl"> + <PropertyGroup Condition="'@(WxlTemplate)' != ''"> + <_Content>$([System.IO.File]::ReadAllText(%(WxlTemplate.FullPath)).Replace(`{{ShortVersion}}`, `$(MajorVersionNumber).$(MinorVersionNumber)$(PyTestExt)`).Replace(`{{LongVersion}}`, `$(PythonVersion)$(PyTestExt)`).Replace(`{{Bitness}}`, `$(Bitness)`))</_Content> + <_ExistingContent Condition="Exists('$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl')">$([System.IO.File]::ReadAllText($(IntermediateOutputPath)%(WxlTemplate.Filename).wxl))</_ExistingContent> + </PropertyGroup> + + <WriteLinesToFile File="$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl" + Lines="$(_Content)" + Overwrite="true" + Condition="$(_Content) != $(_ExistingContent)" /> + + <ItemGroup Condition="'@(WxlTemplate)' != ''"> + <EmbeddedResource Include="$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl" /> + <FileWrites Include="$(IntermediateOutputPath)%(WxlTemplate.Filename).wxl" /> + </ItemGroup> + </Target> + + <Import Project="$(WixTargetsPath)" /> + + <Target Name="SignCabs"> + <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> + <Exec Command="$(_SignCommand) @(SignCabs->'"%(FullPath)"',' ')" ContinueOnError="false" /> + </Target> + <Target Name="SignMsi"> + <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> + <Exec Command="$(_SignCommand) @(SignMsi->'"%(FullPath)"',' ')" ContinueOnError="false" /> + </Target> + <Target Name="SignBundleEngine"> + <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> + <Exec Command="$(_SignCommand) @(SignBundleEngine->'"%(FullPath)"',' ')" ContinueOnError="false" /> + </Target> + <Target Name="SignBundle"> + <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" /> + <Exec Command="$(_SignCommand) @(SignBundle->'"%(FullPath)"',' ')" ContinueOnError="false" /> + </Target> +</Project> \ No newline at end of file diff --git a/pypy/tool/release/windowsinstaller/wix.props b/pypy/tool/release/windowsinstaller/wix.props new file mode 100644 --- /dev/null +++ b/pypy/tool/release/windowsinstaller/wix.props @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\PCbuild\python.props" /> + + <PropertyGroup> + <WixInstallPath Condition="'$(WixInstallPath)' == '' and Exists('$(MSBuildThisFileDirectory)\Wix')">$(MSBuildThisFileDirectory)\Wix\</WixInstallPath> + <WixInstallPath Condition="'$(WixInstallPath)' == '' and Exists('$(MSBuildExtensionsPath32)')">$(MSBuildExtensionsPath32)\Microsoft\Wix\v3.x\</WixInstallPath> + <WixInstallPath Condition="'$(WixInstallPath)' == '' and Exists('$(ExternalsDir)\windows-installer\wix')">$(ExternalsDir)\windows-installer\wix\</WixInstallPath> + <WixInstallPath Condition="'$(WixInstallPath)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Installer XML\3.11@InstallRoot)</WixInstallPath> + <WixInstallPath Condition="'$(WixInstallPath)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Installer XML\3.11@InstallRoot)</WixInstallPath> + <WixTargetsPath>$(WixInstallPath)\Wix.targets</WixTargetsPath> + </PropertyGroup> +</Project> \ No newline at end of file _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit