安装车轮后发布安装脚本 [英] Post install script after installing a wheel
问题描述
使用from setuptools.command.install import install
,如果运行python setup.py install
,则可以轻松运行自定义的安装后脚本.这是相当琐碎的.
Using from setuptools.command.install import install
, I can easily run a custom post-install script if I run python setup.py install
. This is fairly trivial to do.
当前,该脚本除了打印一些文本外什么都不做,但我希望它处理安装新软件包时需要进行的系统更改-例如,备份该软件包正在使用的数据库.
Currently, the script does nothing but print some text but I want it to deal with system changes that need to happen when a new package is installed -- for example, back up the database that the package is using.
我想为我的程序包生成一个Python轮,然后将其复制并安装到一组部署计算机上.但是,我的自定义安装脚本不再在部署计算机上运行.
I want to generate the a Python wheel for my package and then copy that and install it on a a set of deployment machines. However, my custom install script is no longer run on the deployment machine.
我做错了什么?那有可能吗?
What am I doing wrong? Is that even possible?
推荐答案
PEP 427 which specifies the wheel package format does not leave any provisions for custom pre or post installation scripts.
因此,在车轮套件安装期间无法运行自定义脚本.
Therefore running a custom script is not possible during wheel package installation.
您必须将自定义脚本添加到程序包中您希望开发人员首先执行的位置.
You'll have to add the custom script to a place in your package where you expect the developer to execute first.
这篇关于安装车轮后发布安装脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!