Skip to content

Commit

Permalink
Customize and brand Windows installer build
Browse files Browse the repository at this point in the history
Summary:
this patches our fork of the Python 3.12 Windows installer, making customization and branding it as "Meta Python".

in particular, customizing the ReleaseURI and various registry keys allows Meta Python to coexist side-by-side with other installed Pythons of the same version (like the 3.12.1 from the official upstream installer) without interfering.

it's unfortunately this is a rather invasive patch, but understandably, the upstream installer is not designed for ease of branding and customization. we can explore extending the upstream installer to better support such branding & customization as a follow-up.

Reviewed By: amyreese, lisroach, aleivag

Differential Revision: D52912035

fbshipit-source-id: 6a68f8212cb399259e7869e41b4462557f83c4be
  • Loading branch information
itamaro authored and facebook-github-bot committed Jan 19, 2024
1 parent 6028747 commit 3978e5c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 38 deletions.
5 changes: 3 additions & 2 deletions Tools/msi/buildrelease.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rem Variable Description Example
rem {arch} architecture amd64, win32
rem Do not change the scheme to https. Otherwise, releases built with this
rem script will not be upgradable to/from official releases of Python.
set RELEASE_URI=http://www.python.org/{arch}
set RELEASE_URI=custom_meta_python

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
Expand All @@ -27,7 +27,8 @@ 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 DOWNLOAD_URL=""
set DOWNLOAD_URL_BASE=""

set D=%~dp0
set PCBUILD=%D%..\..\PCbuild\
Expand Down
8 changes: 4 additions & 4 deletions Tools/msi/bundle/bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
Version="$(var.Version)"
IconSourceFile="..\..\..\PC\icons\setup.ico"
Manufacturer="!(loc.Manufacturer)"
AboutUrl="https://www.python.org/"
AboutUrl="https://fburl.com/about-python"
Compressed="no"
dep:ProviderKey="CPython-$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
dep:ProviderKey="MetaPython-$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<BootstrapperApplication Id="PythonBA" SourceFile="$(var.BootstrapApp)">
<Payload Compressed='yes' SourceFile='Default.thm' />
<Payload Compressed='yes' SourceFile='$(var.DefaultWxl)' />
Expand All @@ -23,8 +23,8 @@

<Variable Name="ShortVersion" Value="$(var.MajorVersionNumber).$(var.MinorVersionNumber)" />
<Variable Name="ShortVersionNoDot" Value="$(var.MajorVersionNumber)$(var.MinorVersionNumber)" />
<Variable Name="WinVer" Value="$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)" />
<Variable Name="WinVerNoDot" Value="$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)" />
<Variable Name="WinVer" Value="$(var.MajorVersionNumber).$(var.MinorVersionNumber)+meta$(var.PyArchExt)$(var.PyTestExt)" />
<Variable Name="WinVerNoDot" Value="$(var.MajorVersionNumber)$(var.MinorVersionNumber)meta$(var.PyArchExt)$(var.PyTestExt)" />

<Variable Name="InstallAllUsers" Value="0" bal:Overridable="yes" />
<?if "$(var.PyTestExt)"="" ?>
Expand Down
20 changes: 10 additions & 10 deletions Tools/msi/common.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<Fragment>
<Property Id="ROOTREGISTRYKEY" Value="Software\Python\PythonCore" />
</Fragment>

<Fragment>
<Property Id="REGISTRYKEY" Value="Software\Python\PythonCore\$(var.ShortVersion)$(var.PyArchExt)$(var.PyTestExt)" />
<Property Id="REGISTRYKEY" Value="Software\Python\PythonCore\$(var.ShortVersion)+meta$(var.PyArchExt)$(var.PyTestExt)" />
</Fragment>

<Fragment>
<Component Id="OptionalFeature" Guid="*" Directory="InstallDirectory">
<Condition>OPTIONALFEATURESREGISTRYKEY</Condition>
Expand All @@ -16,16 +16,16 @@
</RegistryKey>
</Component>
</Fragment>

<Fragment>
<Property Id="UpgradeTable" Value="1" />

<?ifndef SuppressUpgradeTable ?>
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Property="DOWNGRADE" Minimum="$(var.Version)" IncludeMinimum="no" OnlyDetect="yes" />
<UpgradeVersion Property="UPGRADE" Minimum="$(var.UpgradeMinimumVersion)" IncludeMinimum="yes" Maximum="$(var.Version)" IncludeMaximum="no" />
</Upgrade>

<?ifdef CoreUpgradeCode ?>
<?if $(var.UpgradeCode)!=$(var.CoreUpgradeCode) ?>
<Upgrade Id="$(var.CoreUpgradeCode)">
Expand All @@ -34,7 +34,7 @@
<Condition Message="!(loc.IncorrectCore)">Installed OR NOT MISSING_CORE</Condition>
<?endif ?>
<?endif ?>

<Condition Message="!(loc.NoDowngrade)">Installed OR NOT DOWNGRADE</Condition>
<Condition Message="!(loc.NoTargetDir)">Installed OR TARGETDIR OR Suppress_TARGETDIR_Check</Condition>

Expand All @@ -43,15 +43,15 @@
</InstallExecuteSequence>
<?endif ?>
</Fragment>

<Fragment>
<!-- Include an icon for the Programs and Features dialog -->
<Icon Id="ARPIcon" SourceFile="!(bindpath.src)PC\icons\python.ico" />
<Property Id="ARPPRODUCTICON" Value="ARPIcon" />
<Property Id="ARPNOMODIFY" Value="1" />
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
</Fragment>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<?ifdef InstallDirectoryGuidSeed ?>
Expand All @@ -73,7 +73,7 @@
<?endif ?>
<Property Id="DetectTargetDir" Value="1" />
</Fragment>

<!-- Top-level directories -->
<Fragment>
<DirectoryRef Id="InstallDirectory">
Expand Down
20 changes: 10 additions & 10 deletions Tools/msi/common_en-US.wxl_template
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="LCID">1033</String>
<String Id="Culture">en-us</String>
<String Id="ProductName">Python {{ShortVersion}}</String>
<String Id="FullProductName">Python {{LongVersion}} ({{Bitness}})</String>
<String Id="Title">Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}})</String>
<String Id="Description">Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}})</String>
<String Id="TitlePdb">Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}} symbols)</String>
<String Id="DescriptionPdb">Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}} symbols)</String>
<String Id="Title_d">Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}} debug)</String>
<String Id="Description_d">Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}} debug)</String>
<String Id="Manufacturer">Python Software Foundation</String>
<String Id="ProductName">Meta Python {{ShortVersion}}</String>
<String Id="FullProductName">Meta Python {{LongVersion}} ({{Bitness}})</String>
<String Id="Title">Meta Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}})</String>
<String Id="Description">Meta Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}})</String>
<String Id="TitlePdb">Meta Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}} symbols)</String>
<String Id="DescriptionPdb">Meta Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}} symbols)</String>
<String Id="Title_d">Meta Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}} debug)</String>
<String Id="Description_d">Meta Python {{LongVersion}} !(loc.Descriptor) ({{Bitness}} debug)</String>
<String Id="Manufacturer">PLF / Python Software Foundation</String>
<String Id="NoDowngrade">A newer version of !(loc.ProductName) is already installed.</String>
<String Id="IncorrectCore">An incorrect version of a prerequisite package is installed. Please uninstall any other versions of !(loc.ProductName) and try installing this again.</String>
<String Id="NoTargetDir">The TARGETDIR variable must be provided when invoking this installer.</String>
<String Id="ManufacturerSupportUrl">https://www.python.org/</String>
<String Id="ManufacturerSupportUrl">https://fburl.com/python-support</String>
</WixLocalization>
4 changes: 2 additions & 2 deletions Tools/msi/exe/exe_en-US.wxl_template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="Descriptor">Executables</String>
<String Id="ShortDescriptor">executable</String>
<String Id="ShortcutName">Python {{ShortVersion}} ({{Bitness}})</String>
<String Id="ShortcutName">Meta Python {{ShortVersion}} ({{Bitness}})</String>
<String Id="ShortcutDescription">Launches the !(loc.ProductName) interpreter.</String>
<String Id="SupportUrl">https://www.python.org/</String>
<String Id="SupportUrl">https://fburl.com/python-support</String>
</WixLocalization>
20 changes: 10 additions & 10 deletions Tools/msi/tcltk/tcltk_reg.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@
<!-- We fix the guid of the Subcommands key so that it is correctly reference counted -->
<Component Id="assoc_subcommands" Directory="InstallDirectory" Guid="{57D47B4C-96E6-40A0-A958-57083D74423F}">
<Condition>VersionNT > 600</Condition>
<RegistryValue Root="HKCR" Key="Python.File\Shell\editwithidle$(var.PyTestExt)" Name="MUIVerb" Value="!(loc.EditMenu)" Type="string" KeyPath="yes" />
<RegistryValue Root="HKCR" Key="Python.File\Shell\editwithidle$(var.PyTestExt)" Name="Subcommands" Value="" Type="string" KeyPath="no" />
<RegistryValue Root="HKCR" Key="Python.File\Shell\metaeditwithidle$(var.PyTestExt)" Name="MUIVerb" Value="!(loc.EditMenu)" Type="string" KeyPath="yes" />
<RegistryValue Root="HKCR" Key="Python.File\Shell\metaeditwithidle$(var.PyTestExt)" Name="Subcommands" Value="" Type="string" KeyPath="no" />
</Component>
<Component Id="assoc_subcommands_nocon" Directory="InstallDirectory" Guid="{07061D85-9151-4FC4-BB78-13628020D026}">
<Condition>VersionNT > 600</Condition>
<RegistryValue Root="HKCR" Key="Python.NoConFile\Shell\editwithidle$(var.PyTestExt)" Name="MUIVerb" Value="!(loc.EditMenu)" Type="string" KeyPath="yes" />
<RegistryValue Root="HKCR" Key="Python.NoConFile\Shell\editwithidle$(var.PyTestExt)" Name="Subcommands" Value="" Type="string" KeyPath="no" />
<RegistryValue Root="HKCR" Key="Python.NoConFile\Shell\metaeditwithidle$(var.PyTestExt)" Name="MUIVerb" Value="!(loc.EditMenu)" Type="string" KeyPath="yes" />
<RegistryValue Root="HKCR" Key="Python.NoConFile\Shell\metaeditwithidle$(var.PyTestExt)" Name="Subcommands" Value="" Type="string" KeyPath="no" />
</Component>

<Component Id="assoc_editwithidle" Directory="InstallDirectory">
<Condition>VersionNT > 600</Condition>
<RegistryKey Root="HKCR" Key="Python.File\Shell\editwithidle\shell\edit$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<RegistryKey Root="HKCR" Key="Python.File\Shell\editwithidle\shell\metaedit$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<RegistryValue Name="MUIVerb" Value="!(loc.EditSubMenu)" Type="string" KeyPath="yes" />
<RegistryValue Key="command" Value='"[PYTHONW_EXE]" -m idlelib "%L" %*' Type="string" />
</RegistryKey>
</Component>
<Component Id="assoc_editwithidle_nocon" Directory="InstallDirectory">
<Condition>VersionNT > 600</Condition>
<RegistryKey Root="HKCR" Key="Python.NoConFile\Shell\editwithidle\shell\edit$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<RegistryKey Root="HKCR" Key="Python.NoConFile\Shell\editwithidle\shell\metaedit$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<RegistryValue Name="MUIVerb" Value="!(loc.EditSubMenu)" Type="string" KeyPath="yes" />
<RegistryValue Key="command" Value='"[PYTHONW_EXE]" -m idlelib "%L" %*' Type="string" />
</RegistryKey>
</Component>

<Component Id="assoc_editwithidle_vista" Directory="InstallDirectory">
<Condition>VersionNT = 600</Condition>
<RegistryKey Root="HKCR" Key="Python.File\Shell\editwithidle$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<RegistryKey Root="HKCR" Key="Python.File\Shell\metaeditwithidle$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<RegistryValue Value="!(loc.EditSubMenu)" Type="string" KeyPath="yes" />
<RegistryValue Key="command" Value='"[PYTHONW_EXE]" -m idlelib "%L" %*' Type="string" />
</RegistryKey>
</Component>
<Component Id="assoc_editwithidle_nocon_vista" Directory="InstallDirectory">
<Condition>VersionNT = 600</Condition>
<RegistryKey Root="HKCR" Key="Python.NoConFile\Shell\editwithidle$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<RegistryKey Root="HKCR" Key="Python.NoConFile\Shell\metaeditwithidle$(var.MajorVersionNumber)$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)">
<RegistryValue Value="!(loc.EditSubMenu)" Type="string" KeyPath="yes" />
<RegistryValue Key="command" Value='"[PYTHONW_EXE]" -m idlelib "%L" %*' Type="string" />
</RegistryKey>
Expand Down

0 comments on commit 3978e5c

Please sign in to comment.