1

I found Question#1321270 for post install. My main target for the moment is bdist_wininst, but i did not find anything related to uninstall...

For clarification:
I want to register a com server after installation and de-register it before uninstall.

Extended answer:
ars' answer seems correct, however, for the completeness of things (I think the docs leave some room for improvements on this topic...):
I have NOT as was suggested by mention of Question#1321270 extended distutils.command.install, but written a new python sript called scripts/install.py and set the following in setup.py:

setup(
    ...
    scripts=['scripts\install.py'],
    options = {
        ...
        "bdist_wininst" : {
            "install_script" : "install.py", 
            ...
        },
    }
)

The install.py is definitively being called on install. It seems, though that it is (despite to what the docs say) not being called on uninstall...

Community
  • 1
  • 1
Nils
  • 9,682
  • 6
  • 46
  • 72

1 Answers1

1

The same post-install script will run at uninstall with different arguments. See the docs for more info:

This script will be run at installation time on the target system after all the files have been copied, with argv1 set to -install, and again at uninstallation time before the files are removed with argv1 set to -remove.

ars
  • 120,335
  • 23
  • 147
  • 134
  • looks correct, but does not happen. Is it possible that the unistallation part is not correct for bdist_wininst ?? – Nils Aug 03 '10 at 21:05
  • I think the script has to be in the root directory (your setup indicates it's under a "scripts" folder). – ars Aug 03 '10 at 23:05
  • No, regardless of where the script resides (root, subdirectory) it is only used in post-install, never in pre-uninstall. This happens on Win7, amd64. I'll try on WinXP, x86 tonight. – Nils Aug 05 '10 at 07:22
  • I thinkt this is a correct answer as it's what the docs say _should_ work… – Nils Aug 18 '10 at 07:54
  • There is a known Python bug that causes this not to work: see http://bugs.python.org/issue13276 – Petri Sep 21 '16 at 04:41