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

发布于 2024-09-12 13:04:30 字数 864 浏览 12 评论 0原文

我找到了安装后的问题#1321270 。我目前的主要目标是 bdist_wininst,但我没有找到任何与卸载相关的内容...

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

扩展答案:
然而,为了事情的完整性,ars 的答案似乎是正确的(我认为文档在这个主题上留下了一些改进的空间......):
我没有按照提及 Question#1321270 的建议 扩展了 distutils.command.install,但编写了一个名为 scripts/install.py 的新 Python 脚本,并在 setup.py 中设置以下内容:

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

install.py安装时肯定会被调用。看起来,尽管它(尽管文档所说)在卸载时没有被调用......

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不忘初心 2024-09-19 13:04:30

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

复制所有文件后,此脚本将在安装时在目标系统上运行,参数为 argv1 设置为 -install,并在卸载时再次使用 argv1 设置为 -remove。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文