bpo-44934: Add optional feature AppendPath to Windows msi installer #27889
Conversation
Copy/paste/modify the strings for PrependPathLabel and ShortPrependPath label to introduce AppendPathLabel and ShortAppendPathLabel
Introduce the AppendPath variable in the file where PrependPath is declared
Assign a regname to the new variable in the OPTIONAL_FEATURES struct of the main installer application
In order to build the new msi declare it as a package
Add the upcoming appendpath MSI and its systemwide/current user aliases as a fragment in postinstall.wxs
This new msi is basically just a clone of the path msi with adapted strings, i.e. replaced occurences of path with analog appendpath versions
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
Previously the Scripts and InstallDirectory were appended only for Local Machine installs, but prepended for Current User installs. This changes the current user install to the expected behaviour.
We'll also need a NEWS entry for this (click "Details" on the failed check), and add a short writeup to |
Probably also worth doing a full text search of the repository for any other references in case they also need updating. Because this generates a file at the end of the deployment process, its name may have leaked all over the place. |
Could you elaborate what I should search for exactly? |
New command line only option for Windows installer: AppendPath which behaves similar to PrependPath but appends the directories to the path instead of prepending them
Mention the AppendPath command line option for the Windows installer
Add the ApppendPath option to the table of supported command line options
Since I currently can only access github from a browser I added the NEWS entry and Windows documentation update from the Web UI, hope it pans out. |
This PR is stale because it has been open for 30 days with no activity. |
Initial problem
Automatically adding Python to the
PATH
is convenient for Windows end users; this was achieved by the installer by prepending the Python Install and Scripts dir toPATH
. However this might cause conflicts with system executables.How to reproduce:
Add Python to environment variables
optional featurespip install impacket
Installing impacket in a system context drops - among others - the following Python scripts to the Scripts dir:
reg.py
ping.py
Some batch scripts using commands like
REG ADD HKEY_CURRENT_USER\Console /v Test /d "Test Data"
ping domain.controller
that expect to run
C:\Windows\System32\reg.exe
now runC:\Program Files\Python\Scripts\reg.py
.Conflicts with other use cases
After reporting my problem @zooba reasoned that Python developers might have different versions of Python installed and to make sure they always use the version installed last he chose to prepend those directories instead of appending them to
PATH
.Proposed solution
In order to provide system administrators with a way to automatically add Python to
PATH
by appending it, @zooba suggested to create an command line only separate optional feature for this. Therefore - without any preexisting knowledge of msi or the WiX toolset - I browsed the existing code for the path optional feature and basically duplicated the occurences of that optional feature.Possible problems
I did not introduce any layout in the GUI of the installer. I also didn't implement any checks if e.g. the
path
andappendpath
optional feature are set simultaneousely when running the installer via CLI, thus a user might have 2 occurences of the install and scripts directory if they chosse to use both flags. @zooba said in the BPO report that this would probably be fine.Also my PR might be very far from being able to succesfully compile since I have no prior experience of thw WiX toolset and couldn't get a clean build with the provided instructions in Tools/msi/README.txt on one of the free Windows 10 Edge Test VM even before modifying the source code. @zooba suggested to submit this PR anyway since the build pipeline would show if everything builds.
https://bugs.python.org/issue44934
The text was updated successfully, but these errors were encountered: