将 setuptools 与安装后和 python 依赖项一起使用

发布于 2024-08-01 18:08:50 字数 768 浏览 6 评论 0原文

这与这个问题有些相关。 假设我有一个想要通过 rpm 部署的包,因为我需要在安装后进行一些文件复制,并且我有一些想要声明的非 python 依赖项。 但我们还要假设我有一些可以在 PyPI 中轻松使用的 Python 依赖项。 似乎如果我只是打包为鸡蛋,解压后紧接着 python setup.py install 将自动处理我的 python 依赖项,但代价是丢失任何安装后功能和非 python依赖关系。

有没有推荐的方法来做到这一点? 我想我可以在预安装脚本中指定这一点,但随后我会陷入信息重复,并且不会真正使用 setuptools 来完成大部分事情。

(我当前的设置涉及将 install_requires = ['dependency_name'] 传递给 setup,这适用于 python setup.py bdist_eggunzip my_package.egg; python my_package/setup.py install,但不适用于 python setup.py bdist_rpm --post-install post-install.shrpm --install my_package .rpm。)

This is somewhat related to this question. Let's say I have a package that I want to deploy via rpm because I need to do some file copying on post-install and I have some non-python dependencies I want to declare. But let's also say I have some python dependencies that are easily available in PyPI. It seems like if I just package as an egg, an unzip followed by python setup.py install will automatically take care of my python dependencies, at the expense of losing any post-install functionality and non-python dependencies.

Is there any recommended way of doing this? I suppose I could specify this in a pre-install script, but then I'm getting into information duplication and not really using setuptools for much of anything.

(My current setup involves passing install_requires = ['dependency_name'] to setup, which works for python setup.py bdist_egg and unzip my_package.egg; python my_package/setup.py install, but not for python setup.py bdist_rpm --post-install post-install.sh and rpm --install my_package.rpm.)

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

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

发布评论

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

评论(1

无所的.畏惧 2024-08-08 18:08:50

我认为如果你的 python 依赖项也可以作为 RPM 提供,并在 RPM 中声明为依赖项,那将是最好的。 如果它们在其他地方不可用,请自行创建它们,并将它们放入您的 yum 存储库中。

运行 PyPI 安装作为 RPM 安装的副作用是邪恶的,因为它不支持正确的卸载(即卸载 RPM 将删除您的软件包,但留下依赖项,没有正确的删除过程)。

I think it would be best if your python dependencies were available as RPMs also, and declared as dependencies in the RPM. If they aren't available elsewhere, create them yourself, and put them in your yum repository.

Running PyPI installations as a side effect of RPM installation is evil, as it won't support proper uninstallation (i.e. uninstalling your RPM will remove your package, but leave the dependencies behind, with no proper removal procedure).

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