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.

classification
Title: bdist_msi does not pass -install/remove flags to install_script
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Pierre.Raybaut, braudel, eric.araujo, loneraver, paul.moore, petri, steve.dower, tarek, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2012-08-28 09:51 by braudel, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.diff braudel, 2012-08-28 09:51 bdist_msi.py patch to add -install/-remove flags
patch1.diff braudel, 2012-08-28 15:38 a little cleaner patch
Messages (8)
msg169262 - (view) Author: B Maqueira (braudel) Date: 2012-08-28 09:51
When building an msi package using the --install-script=xx.py, the script "xx.py" is called on msi package install/removal as expected. However the cmd line flags -install/-remove are not passed to the script making it hard to write "step specific" code. 

I experienced this under python 2.7.3 (winXP / distutils 2.7.3, setuptools 0.6c11).

I attach a patch for bdist_msi.py for your consideration.

Kind regards,

Braudel
msg184957 - (view) Author: Pierre Raybaut (Pierre.Raybaut) Date: 2013-03-22 11:06
The submitted patch actually works (tested with Python 2.7.3 on Windows XP) and also fixes another bug: the installation script is executed when uninstalling (that feature is not implemented in current Python stable versions despite the mention in docstrings that install script should be executed at deinstallation).
msg192219 - (view) Author: B Maqueira (braudel) Date: 2013-07-02 22:24
Hi Eric,

Any news/status on this bug? 

For a use case of this functionality please have a look at a demo I did a while ago at CamPUG (https://github.com/campug/braudel_sample_server).
msg277056 - (view) Author: Petri Savolainen (petri) Date: 2016-09-20 18:55
Any chance the patch could be processed?
msg277057 - (view) Author: Petri Savolainen (petri) Date: 2016-09-20 19:16
If I understood the patch correctly, while adding the '-install' and '-remove' arguments, the patch also removes sys.argv[0], ie. the (install) script name. Why? That also changes the the documented behavior.

The patch also appears to add an uninstall script. That would be a nice bonus. But should it be a separate issue & patch?
msg290790 - (view) Author: Henry Borchers (loneraver) Date: 2017-03-29 20:45
Any progress on this? It seems to still be an issue in Python 3.6.
msg290800 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-03-30 01:16
Unless this is documented somewhere, it's a new feature in a deprecated module.

You can easily produce a third-party distutils command that does this differently, but I see limited benefit in changing this command. I'd also need to dig deeper to learn how bdist_msi works to make sure the change is sound, which I'm not entirely convinced it is (MSI custom actions are very difficult to get right, and have a lot of strange quirks - the big concern here would be breaking a property reference by adding the option in the wrong column, instead of using a custom action to set the property that is referenced from the action that executes it).

In short, non-trivial, rarely used, easily overrideable from the build scripts that need it. I'd recommend this for a third party module, but at this stage it should only be changed in the standard library if it doesn't match some documentation.
msg386352 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:21
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:57:35adminsetgithub: 60001
2021-02-03 18:21:25steve.dowersetstatus: open -> closed
resolution: out of date
messages: + msg386352

stage: resolved
2017-03-30 01:16:21steve.dowersetmessages: + msg290800
versions: + Python 3.7, - Python 3.6
2017-03-29 21:55:45ned.deilysetnosy: + paul.moore, tim.golden, zach.ware, steve.dower
2017-03-29 20:45:56loneraversetnosy: + loneraver

messages: + msg290790
versions: + Python 3.6, - Python 2.7, Python 3.3, Python 3.4, Python 3.5
2016-09-20 19:16:00petrisetmessages: + msg277057
2016-09-20 18:55:22petrisetnosy: + petri

messages: + msg277056
versions: + Python 3.4, Python 3.5
2013-07-02 22:24:32braudelsetmessages: + msg192219
2013-03-22 11:06:51Pierre.Raybautsetnosy: + Pierre.Raybaut

messages: + msg184957
versions: + Python 3.3
2012-08-28 15:38:08braudelsetfiles: + patch1.diff
2012-08-28 09:51:11braudelcreate