From c4b7600b903aca2fec434801d8d185bd2df65076 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 1 Oct 2015 15:18:53 -0700 Subject: Improves support for building unofficial versions of the Windows installer. --- Tools/msi/buildrelease.bat | 43 +++++++++++++++-------- Tools/msi/bundle/bundle.targets | 7 ++-- Tools/msi/bundle/bundle.wxs | 2 ++ Tools/msi/bundle/packagegroups/launcher.wxs | 4 +++ Tools/msi/bundle/packagegroups/packageinstall.wxs | 26 ++++++++++++++ Tools/msi/bundle/packagegroups/pip.wxs | 25 +++++++++++++ Tools/msi/bundle/packagegroups/postinstall.wxs | 19 ---------- Tools/msi/msi.props | 14 +++++--- 8 files changed, 99 insertions(+), 41 deletions(-) create mode 100644 Tools/msi/bundle/packagegroups/packageinstall.wxs create mode 100644 Tools/msi/bundle/packagegroups/pip.wxs diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat index d22ba10..ea25134 100644 --- a/Tools/msi/buildrelease.bat +++ b/Tools/msi/buildrelease.bat @@ -4,17 +4,28 @@ rem This script is intended for building official releases of Python. rem To use it to build alternative releases, you should clone this file rem and modify the following three URIs. -rem -rem The first two will ensure that your release can be installed -rem alongside an official Python release, while the second specifies -rem the URL that will be used to download installation files. The -rem files available from this URL *will* conflict with your installer. -rem Trust me, you don't want them, even if it seems like a good idea. -set RELEASE_URI_X86=http://www.python.org/win32 -set RELEASE_URI_X64=http://www.python.org/amd64 -set DOWNLOAD_URL_BASE=https://www.python.org/ftp/python -set DOWNLOAD_URL= +rem These two will ensure that your release can be installed +rem alongside an official Python release, by modifying the GUIDs used +rem for all components. +rem +rem The following substitutions will be applied to the release URI: +rem Variable Description Example +rem {arch} architecture amd64, win32 +set RELEASE_URI=http://www.python.org/{arch} + +rem This is the URL that will be used to download installation files. +rem The files available from the default URL *will* conflict with your +rem installer. Trust me, you don't want them, even if it seems like a +rem good idea. +rem +rem The following substitutions will be applied to the download URL: +rem Variable Description Example +rem {version} version number 3.5.0 +rem {arch} architecture amd64, win32 +rem {releasename} release name a1, b2, rc3 (or blank for final) +rem {msi} MSI filename core.msi +set DOWNLOAD_URL=https://www.python.org/ftp/python/{version}/{arch}{releasename}/{msi} set D=%~dp0 set PCBUILD=%D%..\..\PCBuild\ @@ -90,14 +101,12 @@ if "%1" EQU "x86" ( set BUILD_PLAT=Win32 set OUTDIR_PLAT=win32 set OBJDIR_PLAT=x86 - set RELEASE_URI=%RELEASE_URI_X86% ) ELSE ( call "%PCBUILD%env.bat" x86_amd64 set BUILD=%PCBUILD%amd64\ set BUILD_PLAT=x64 set OUTDIR_PLAT=amd64 set OBJDIR_PLAT=x64 - set RELEASE_URI=%RELEASE_URI_X64% ) if exist "%BUILD%en-us" ( @@ -157,10 +166,16 @@ echo -x64 Build x64 installers echo --build (-b) Incrementally build Python rather than rebuilding echo --skip-build (-B) Do not build Python (just do the installers) echo --skip-doc (-D) Do not build documentation -echo --download Specify the full download URL for MSIs (should include {2}) +echo --download Specify the full download URL for MSIs echo --test Specify the test directory to run the installer tests echo -h Display this help information echo. echo If no architecture is specified, all architectures will be built. echo If --test is not specified, the installer tests are not run. -echo. \ No newline at end of file +echo. +echo The following substitutions will be applied to the download URL: +echo Variable Description Example +echo {version} version number 3.5.0 +echo {arch} architecture amd64, win32 +echo {releasename} release name a1, b2, rc3 (or blank for final) +echo {msi} MSI filename core.msi diff --git a/Tools/msi/bundle/bundle.targets b/Tools/msi/bundle/bundle.targets index b77646b..9b7d090 100644 --- a/Tools/msi/bundle/bundle.targets +++ b/Tools/msi/bundle/bundle.targets @@ -16,8 +16,9 @@ $(OutputPath)en-us\ $(OutputPath) - $(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)/$(ArchName)$(ReleaseLevelName)/ - $(DefineConstants);DownloadUrl=$(DownloadUrl){2} + + $(DownloadUrlBase.TrimEnd(`/`))/{version}/{arch}{releasename}/{msi} + $(DefineConstants);DownloadUrl=$(DownloadUrl.Replace(`{version}`, `$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)`).Replace(`{arch}`, `$(ArchName)`).Replace(`{releasename}`, `$(ReleaseName)`).Replace(`{msi}`, `{2}`)) $(DefineConstants);DownloadUrl={2} @@ -88,7 +89,7 @@ - diff --git a/Tools/msi/bundle/bundle.wxs b/Tools/msi/bundle/bundle.wxs index cc62c62..5e343a2 100644 --- a/Tools/msi/bundle/bundle.wxs +++ b/Tools/msi/bundle/bundle.wxs @@ -85,6 +85,8 @@ + + diff --git a/Tools/msi/bundle/packagegroups/launcher.wxs b/Tools/msi/bundle/packagegroups/launcher.wxs index 77c6ac5..4b03fd2 100644 --- a/Tools/msi/bundle/packagegroups/launcher.wxs +++ b/Tools/msi/bundle/packagegroups/launcher.wxs @@ -9,6 +9,8 @@ DownloadUrl="$(var.DownloadUrl)" ForcePerMachine="yes" EnableFeatureSelection="yes" + Permanent="yes" + Visible="yes" InstallCondition="(InstallAllUsers or InstallLauncherAllUsers) and Include_launcher" /> diff --git a/Tools/msi/bundle/packagegroups/packageinstall.wxs b/Tools/msi/bundle/packagegroups/packageinstall.wxs new file mode 100644 index 0000000..249d761 --- /dev/null +++ b/Tools/msi/bundle/packagegroups/packageinstall.wxs @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/Tools/msi/bundle/packagegroups/pip.wxs b/Tools/msi/bundle/packagegroups/pip.wxs new file mode 100644 index 0000000..201a6c4 --- /dev/null +++ b/Tools/msi/bundle/packagegroups/pip.wxs @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tools/msi/bundle/packagegroups/postinstall.wxs b/Tools/msi/bundle/packagegroups/postinstall.wxs index b40c2a5..90627b9 100644 --- a/Tools/msi/bundle/packagegroups/postinstall.wxs +++ b/Tools/msi/bundle/packagegroups/postinstall.wxs @@ -2,25 +2,6 @@ - - - - - - - - - Release x86 perUser + + + + + + - $(ComputerName) + $(ComputerName)/$(ArchName)/ $(ReleaseUri)/ - - @@ -150,7 +154,7 @@ <_Uuids>@(_Uuid->'("%(Identity)", "$(MajorVersionNumber).$(MinorVersionNumber)/%(Uri)")',',') - <_GenerateCommand>import uuid; print('\n'.join('{}={}'.format(i, uuid.uuid5(uuid.UUID('c8d9733e-a70c-43ff-ab0c-e26456f11083'), '$(ReleaseUri)' + j)) for i,j in [$(_Uuids.Replace(`"`,`'`))])) + <_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(`"`,`'`))]))