在 Python Egg 中运行安装后脚本 (setuptools)
我创建了一个小的 Python Egg(带有 setuptools),我想将其安装在 LAN 的其他计算机上。我什至为鸡蛋和所有东西设置了一个服务器(并且鸡蛋已使用 easy_install -f http://myserver/eggrepository
正确下载并安装):-)
我想知道是否有使用 easy_install(版本 0.6c11 和 python2.6)安装脚本时运行脚本(bash 或 Python)的方式。
我在包中添加了一个bash脚本,我希望能够在安装egg时自动运行它(主要是启动rcX.d级别中的一些功能,在启动时开始运行等...) 。现在我必须转到 /usr/local/lib/python2.6/dist-packages,找到安装我的 Egg 的文件夹并运行所述 Egg 中的 bash 脚本...但该解决方案不是很好准确,我确信如果我更改版本、路径等,它会给我带来问题...
我一直在阅读,我发现一些帖子说这是不可能的,但它们有点旧,也许有办法现在...我还发现其他人说可以使用 distutils (这意味着 setuptools 也可以做到),但我一直无法使用 setuptools 找到任何合适的解决方案。
提前谢谢您
相关:
I have created a little Python egg (with setuptools) that I want to install in other machines of my LAN. I have even setup a server for the eggs and all (and the egg is properly downloaded and installed with easy_install -f http://myserver/eggrepository
) :-)
I would like to know if there's a way of running an script (bash or Python) when installing it with easy_install (version 0.6c11 and python2.6).
I have added a bash script to the package, and I'd like to be able to run it automatically (mainly to start some functionalities in the rcX.d levels, start running at startup, etc...) when the egg is installed. Right now I have to go to the /usr/local/lib/python2.6/dist-packages, find the folder where my egg was installed and run the bash script that is in said egg... But that solution is not very accurate and I'm sure it will give me problems if I change versions, paths, etc...
I've been reading and I found some posts saying it wasn't possible, but they are a bit old and maybe there's a way now... I also found others saying it was possible with distutils (which means that probably setuptools can do it too) but I haven't been able to find any suitable solution using setuptools.
Thank you in advance
Related:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧...我找到了解决方法...
python-packaging-custom-scripts
它不是这样正如我所希望的那样直接,但是……
我可以将安装过程放在 sh 文件中,然后,由于用户路径中会有一个 Python 脚本,我可以从安装包的 bash 脚本中调用它...
Ok... I found a workaround...
python-packaging-custom-scripts
It's not as straight-forward as I would have liked, but well...
I can put the installation process in an sh file and then, since there's going to be a Python script in the user's path, I can call it from the bash script installing the package...