summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorbneuburg <bastian.neuburger@gmail.com>2022-01-18 00:18:44 (GMT)
committerGitHub <noreply@github.com>2022-01-18 00:18:44 (GMT)
commitc47c9e6589eb7a272cfe4d352eb87389eb20ec2f (patch)
tree715cba1337e28d4d2d78a123e4590963422b700b /Tools
parent9e20ec4d437993715a8d1317a9b80043e6c07fe1 (diff)
downloadcpython-c47c9e6589eb7a272cfe4d352eb87389eb20ec2f.zip
cpython-c47c9e6589eb7a272cfe4d352eb87389eb20ec2f.tar.gz
cpython-c47c9e6589eb7a272cfe4d352eb87389eb20ec2f.tar.bz2
bpo-44934: Add optional feature AppendPath to Windows MSI installer (GH-27889)
The option must be enabled from the command line
Diffstat (limited to 'Tools')
-rw-r--r--Tools/msi/appendpath/appendpath.wixproj19
-rw-r--r--Tools/msi/appendpath/appendpath.wxs39
-rw-r--r--Tools/msi/appendpath/appendpath_en-US.wxl6
-rw-r--r--Tools/msi/bundle/Default.wxl2
-rw-r--r--Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp1
-rw-r--r--Tools/msi/bundle/bundle.targets3
-rw-r--r--Tools/msi/bundle/bundle.wxs3
-rw-r--r--Tools/msi/bundle/packagegroups/postinstall.wxs23
8 files changed, 93 insertions, 3 deletions
diff --git a/Tools/msi/appendpath/appendpath.wixproj b/Tools/msi/appendpath/appendpath.wixproj
new file mode 100644
index 0000000..8970876
--- /dev/null
+++ b/Tools/msi/appendpath/appendpath.wixproj
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectGuid>{12B59A06-37CC-4558-A9C8-DAE922E64EF3}</ProjectGuid>
+ <SchemaVersion>2.0</SchemaVersion>
+ <OutputName>appendpath</OutputName>
+ <OutputType>Package</OutputType>
+ <SuppressIces>ICE71</SuppressIces>
+ </PropertyGroup>
+ <Import Project="..\msi.props" />
+ <ItemGroup>
+ <Compile Include="*.wxs" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="*.wxl" />
+ </ItemGroup>
+
+ <Import Project="..\msi.targets" />
+</Project>
diff --git a/Tools/msi/appendpath/appendpath.wxs b/Tools/msi/appendpath/appendpath.wxs
new file mode 100644
index 0000000..b972f61
--- /dev/null
+++ b/Tools/msi/appendpath/appendpath.wxs
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Product Id="*" Language="!(loc.LCID)" Name="!(loc.Title)" Version="$(var.Version)" Manufacturer="!(loc.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
+ <Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
+
+ <PropertyRef Id="UpgradeTable" />
+ <PropertyRef Id="REGISTRYKEY" />
+
+ <Feature Id="DefaultFeature" AllowAdvertise="no" Title="!(loc.Title)" Description="!(loc.Description)">
+ <Component Id="AppendPath_CU" Directory="InstallDirectory" Guid="*">
+ <Condition>NOT ALLUSERS=1</Condition>
+ <RegistryKey Root="HKCU" Key="[REGISTRYKEY]">
+ <RegistryValue KeyPath="yes" Key="InstalledFeatures" Name="$(var.OptionalFeatureName)" Value="$(var.Version)" Type="string" />
+ </RegistryKey>
+
+ <CreateFolder Directory="Scripts" />
+ <RemoveFolder Id="Remove_Scripts_CU" Directory="Scripts" On="uninstall" />
+
+ <Environment Id="PATH_CU" Action="set" Name="PATH" Part="last" Value="[InstallDirectory]" />
+ <Environment Id="SCRIPTS_PATH_CU" Action="set" Name="PATH" Part="last" Value="[Scripts]" />
+ </Component>
+ <Component Id="AppendPath_LM" Directory="InstallDirectory" Guid="*">
+ <Condition>ALLUSERS=1</Condition>
+ <RegistryKey Root="HKLM" Key="[REGISTRYKEY]">
+ <RegistryValue KeyPath="yes" Key="InstalledFeatures" Name="$(var.OptionalFeatureName)" Value="$(var.Version)" Type="string" />
+ </RegistryKey>
+
+ <CreateFolder Directory="Scripts" />
+ <RemoveFolder Id="Remove_Scripts_LM" Directory="Scripts" On="uninstall" />
+
+ <Environment Id="PATH_LM" Action="set" Name="PATH" Part="last" Value="[InstallDirectory]" System="yes" />
+ <Environment Id="SCRIPTS_PATH_LM" Action="set" Name="PATH" Part="last" Value="[Scripts]" System="yes" />
+ <Environment Id="PY_PATHEXT_LM" Action="set" Name="PATHEXT" Part="last" Value=".PY" System="yes" />
+ <Environment Id="PYW_PATHEXT_LM" Action="set" Name="PATHEXT" Part="last" Value=".PYW" System="yes" />
+ </Component>
+ </Feature>
+ </Product>
+</Wix>
+
diff --git a/Tools/msi/appendpath/appendpath_en-US.wxl b/Tools/msi/appendpath/appendpath_en-US.wxl
new file mode 100644
index 0000000..19a2e77
--- /dev/null
+++ b/Tools/msi/appendpath/appendpath_en-US.wxl
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
+ <String Id="Descriptor">Append to Path</String>
+ <String Id="ShortDescriptor">AppendPath</String>
+ <String Id="NoPython">No !(loc.ProductName) installation was detected.</String>
+</WixLocalization>
diff --git a/Tools/msi/bundle/Default.wxl b/Tools/msi/bundle/Default.wxl
index 791ce6e..053306b 100644
--- a/Tools/msi/bundle/Default.wxl
+++ b/Tools/msi/bundle/Default.wxl
@@ -84,6 +84,8 @@ Select Customize to review current options.</String>
<String Id="ShortcutsLabel">Create shortcuts for installed applications</String>
<String Id="PrependPathLabel">Add Python to &amp;environment variables</String>
<String Id="ShortPrependPathLabel">Add &amp;Python [ShortVersion] to PATH</String>
+ <String Id="AppendPathLabel">Append Python to &amp;environment variables</String>
+ <String Id="ShortAppendPathLabel">Append &amp;Python [ShortVersion] to PATH</String>
<String Id="InstallAllUsersLabel">Install for &amp;all users</String>
<String Id="InstallLauncherAllUsersLabel">for &amp;all users (requires elevation)</String>
<String Id="ShortInstallLauncherAllUsersLabel">Install &amp;launcher for all users (recommended)</String>
diff --git a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
index 3c54e40..fdc2a21 100644
--- a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
+++ b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
@@ -205,6 +205,7 @@ static struct { LPCWSTR regName; LPCWSTR variableName; } OPTIONAL_FEATURES[] = {
{ L"exe", L"Include_exe" },
{ L"lib", L"Include_lib" },
{ L"path", L"PrependPath" },
+ { L"appendpath", L"AppendPath" },
{ L"pip", L"Include_pip" },
{ L"tcltk", L"Include_tcltk" },
{ L"test", L"Include_test" },
diff --git a/Tools/msi/bundle/bundle.targets b/Tools/msi/bundle/bundle.targets
index f882d2e..5d8ae6c 100644
--- a/Tools/msi/bundle/bundle.targets
+++ b/Tools/msi/bundle/bundle.targets
@@ -67,6 +67,7 @@
<Package Include="..\exe\exe*.wixproj" />
<Package Include="..\lib\lib*.wixproj" />
<Package Include="..\path\path*.wixproj" />
+ <Package Include="..\appendpath\appendpath*.wixproj" />
<Package Include="..\pip\pip*.wixproj" />
<Package Include="..\tcltk\tcltk*.wixproj" />
<Package Include="..\test\test*.wixproj" />
@@ -104,4 +105,4 @@
</Target>
<Import Project="..\msi.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/Tools/msi/bundle/bundle.wxs b/Tools/msi/bundle/bundle.wxs
index e2f8718..a145d84 100644
--- a/Tools/msi/bundle/bundle.wxs
+++ b/Tools/msi/bundle/bundle.wxs
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension">
@@ -87,6 +87,7 @@
<Variable Name="AssociateFiles" Value="1" bal:Overridable="yes" />
<Variable Name="Shortcuts" Value="1" bal:Overridable="yes" />
<Variable Name="PrependPath" Value="0" bal:Overridable="yes" />
+ <Variable Name="AppendPath" Value="0" bal:Overridable="yes" />
<Variable Name="CompileAll" Value="0" bal:Overridable="yes" />
<Variable Name="SimpleInstall" Value="0" bal:Overridable="yes" />
diff --git a/Tools/msi/bundle/packagegroups/postinstall.wxs b/Tools/msi/bundle/packagegroups/postinstall.wxs
index 11ab673..64f42dd 100644
--- a/Tools/msi/bundle/packagegroups/postinstall.wxs
+++ b/Tools/msi/bundle/packagegroups/postinstall.wxs
@@ -20,6 +20,27 @@
<MsiProperty Name="TARGETDIR" Value="[TargetDir]" />
<MsiProperty Name="OPTIONALFEATURESREGISTRYKEY" Value="[OptionalFeaturesRegistryKey]" />
</MsiPackage>
+
+ <MsiPackage Id="appendpath_AllUsers"
+ SourceFile="appendpath.msi"
+ Compressed="$(var.CompressMSI)"
+ DownloadUrl="$(var.DownloadUrl)"
+ ForcePerMachine="yes"
+ InstallCondition="InstallAllUsers and AppendPath and not LauncherOnly">
+ <MsiProperty Name="TARGETDIR" Value="[TargetDir]" />
+ <MsiProperty Name="OPTIONALFEATURESREGISTRYKEY" Value="[OptionalFeaturesRegistryKey]" />
+ </MsiPackage>
+ <MsiPackage Id="appendpath_JustForMe"
+ SourceFile="appendpath.msi"
+ Compressed="$(var.CompressMSI)"
+ DownloadUrl="$(var.DownloadUrl)"
+ ForcePerMachine="no"
+ InstallCondition="not InstallAllUsers and AppendPath and not LauncherOnly">
+ <MsiProperty Name="TARGETDIR" Value="[TargetDir]" />
+ <MsiProperty Name="OPTIONALFEATURESREGISTRYKEY" Value="[OptionalFeaturesRegistryKey]" />
+ </MsiPackage>
+
+
<?define CompileAllCommand=-E -s -Wi "[TargetDir]\Lib\compileall.py" -f -x "bad_coding|badsyntax|site-packages|py2_|lib2to3\\tests|venv\\scripts" "[TargetDir]\Lib"?>
<ExePackage Id="compileall_AllUsers"
@@ -85,4 +106,4 @@
InstallCondition="not InstallAllUsers and CompileAll and not LauncherOnly" />
</PackageGroup>
</Fragment>
-</Wix> \ No newline at end of file
+</Wix>