安装轮子后安装后脚本 [英] Post install script after installing a wheel

查看:27
本文介绍了安装轮子后安装后脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 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 指定了车轮包格式,没有为自定义安装前或安装后脚本留下任何规定.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆