This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bn_append
Recipients Saxomania, bn_append, paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-08-24.00:28:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629764894.91.0.997752216861.issue44934@roundup.psfhosted.org>
In-reply-to
Content
Update: .NET 3.5 installation worked out fine via VS 2019 installer, I also added the VS2017 build tools as a precaution since the VM builds take some time.

Afterwards build.bat still failed during wix steps, complaining about missing python.exe in PCBuild/win32, not sure if the 32bit interpreter should be fetched/built automagically. Then I tried build.bat -x64, which ran succesfully and provided attached installer.

To test it (in administrative shell):
1. git clone https://github.com/bneuburg/python_msi_appendpath
2. cd python_appendpath_installer
3. .\python-3.11.0.7539-amd64.exe /quiet InstallAllUsers=1 AppendPath=1 Include_test=0

Running this in an administrative shell appended InstallDir and Installdir/Scripts to the sytem PATH and created the PATHEXT entries for PY and PYC as well. So far so good!

I only noticed the following problem:
The first uninstall also succesfully removed all environment variables, however after reinstalling and re-uninstalling, only the PATHEXT were removed, the Python entries in PATH were not removed. This was also independent of the order of software removal (Python Launcher first or second). 

Thus I had a look at it with orca.exe [1]:
1. Install with appendpath=1
2. Get list of installed msis with: wmic product get /format:csv > software.csv
3. Search for appendpath in software.csv which will return the location of the msi somewhere in c:\windows\installer
4. Right click that file and select 'Edit with Orca'

In the environment table it has entries in the following form for a Local Machine install (c.f. for attached screenshot):

Environment  | Name    | Value                  | Component 
PATH_LM      | =-*PATH | [~]:[InstallDirectory] | AppendPath_LM

which according to Microsoft documentation [2] seems to be as intended (add on install, remove on uninstall). But it just doesn't, also see Sascha's comment above. When looking at Orca I also noticed that I forgot to change the position of InstallDirectory in PATH for the CU install from first to last, I updated the PR accordingly.

Since you have a Microsoft e-mail address: Any chances you could ask the MSI pros there what is going on?
I'll be busy with offline stuff for a few weeks, but if you have any ideas how to troubleshoot this, let me know. I found a discussion where the order of the prefixes for names was slightly changed [3], i.e. *=- instead of =-* but I don't know if this matters at all or how to test it.

Sorry for the text book, things like that really keep me digging.

[1] https://docs.microsoft.com/de-de/windows/win32/msi/orca-exe
[2] https://docs.microsoft.com/en-us/windows/win32/msi/environment-table
[3] https://www.itninja.com/question/add-to-path-envronment-variable
History
Date User Action Args
2021-08-24 00:28:14bn_appendsetrecipients: + bn_append, paul.moore, tim.golden, zach.ware, steve.dower, Saxomania
2021-08-24 00:28:14bn_appendsetmessageid: <1629764894.91.0.997752216861.issue44934@roundup.psfhosted.org>
2021-08-24 00:28:14bn_appendlinkissue44934 messages
2021-08-24 00:28:14bn_appendcreate