如何用一个简单的预卸载脚本扩展distutils?

2024-05-23 21:22:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我找到了安装后的Question#1321270。我目前的主要目标是bdist_wininst,但是我没有找到任何与卸载相关的东西。。。在

澄清:
我想在安装后注册com服务器,并在卸载前取消注册。在

扩展答案:
然而,ars的答案似乎是正确的,但是,为了完整起见(我认为文档在这个主题上留有改进的空间……):
我并没有像提到Question#1321270扩展的distutils.command.install所建议的那样,而是编写了一个名为scripts/install.py的新python sript,并在设置.py公司名称:

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

在install.py安装在安装时确实被调用。看起来,尽管它是(不管文档怎么说)在卸载时没有被调用。。。在


Tags: install答案文档py服务器com目标主题
1条回答
网友
1楼 · 发布于 2024-05-23 21:22:06

相同的安装后脚本将在卸载时使用不同的参数运行。有关详细信息,请参阅docs

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.

相关问题 更多 >