Python distutils-更改路径RPM安装到 [英] Python distutils - Change Path RPM Installs To

查看:141
本文介绍了Python distutils-更改路径RPM安装到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Python 2.7.5,并且正在使用distutils( python setup.py bdist_rpm )创建以下RPM ...

  me @ hostname:/ tmp / dist $ rpm -qpil myApp-2.0.146-1.noarch.rpm 
名称:myApp
版本:2.0.146
发行:1
体系结构:noarch
安装日期:(未安装)
组:开发/库
大小:290576
许可证:GPL
签名:(无)
源RPM:myApp-2.0.146-1.src.rpm
构建日期:2014年10月15日星期三EDT
构建主机:hostname.example.lan
搬迁:/ usr
供应商:Me< me@example.lan>
URL:https://otherhost.example.lan/myApp
摘要:我的应用程序
描述:
我的应用程序
/ tmp / myApp / CHANGELOG
/ tmp / myApp / README
/tmp/myApp/some.sh
/tmp/myApp/some.py
/tmp/myApp/libs/another.py
/ tmp / myApp / libs / another.sh
...

我在尝试什么要实现的是在安装RPM时将文件放入...

  / usr / local / bin / CHANGELOG 
/ usr / local / bin / README
/usr/local/bin/some.sh
/usr/local/bin/some.py
/ usr / local / bin / libs /another.py
/usr/local/bin/libs/another.sh
...

...而不是在/ tmp中。



是的,我知道位置可能是错误的/未达到标准水平/ unconventional / not-best-practice / dumb / whatev在您眼中,但这就是必须的方式。我只是不知道该怎么做。我可以/应该在distutils setup()中做些什么吗(也许当我填充 data_files 参数的 setup()?没关系,但我将分享以下内容,以简单地传达我可以灵活地调用 setup()。我的 setup.py 是由另一个Python脚本动态创建的,然后由另一个脚本通过 subprocess 运行。 / p>

我不知道是否可以暂停 setup.py ,以便我可以操作spec文件。我不能 chroot 伪造东西。不确定如何处理,但看起来应该很简单。

解决方案

答案:而不是动态生成setup.py和使用distutils(这似乎有一些限制),我现在生成rpmbuild .spec并可以执行我需要的操作。



欢呼。


I have Python 2.7.5 and am using distutils (python setup.py bdist_rpm) to create the following RPM...

me@hostname:/tmp/dist$ rpm -qpil myApp-2.0.146-1.noarch.rpm
Name        : myApp
Version     : 2.0.146
Release     : 1
Architecture: noarch
Install Date: (not installed)
Group       : Development/Libraries
Size        : 290576
License     : GPL
Signature   : (none)
Source RPM  : myApp-2.0.146-1.src.rpm
Build Date  : Wed 15 Oct 2014 02:57:08 PM EDT
Build Host  : hostname.example.lan
Relocations : /usr
Vendor      : Me <me@example.lan>
URL         : https://otherhost.example.lan/myApp
Summary     : My application
Description :
My application
/tmp/myApp/CHANGELOG
/tmp/myApp/README
/tmp/myApp/some.sh
/tmp/myApp/some.py
/tmp/myApp/libs/another.py
/tmp/myApp/libs/another.sh
...

What I'm trying to achieve is when the RPM is installed the files get put in...

/usr/local/bin/CHANGELOG
/usr/local/bin/README
/usr/local/bin/some.sh
/usr/local/bin/some.py
/usr/local/bin/libs/another.py
/usr/local/bin/libs/another.sh
...

...rather than in /tmp.

Yes, I understand the locations may be wrong/sub-par/unconventional/not-best-practice/dumb/whatev in your eyes but this is the way it has to be. I just can't figure out how to do it. Is there something I could/should do in my distutils setup() (maybe when I am populating data_files parameter of setup()? This shouldn't matter but I will share the following simply to convey I have flexibility in calling setup(). My setup.py is created dynamically by another Python script and then run by the other script via subprocess.

I don't know that it's possible to "pause" setup.py so I can manipulate the spec file. I can't chroot to fake things. Not sure how to handle this but it seems it should be simple.

解决方案

Answer: Rather than dynamically generating setup.py and using distutils (which seems to have some limitations) I now generate an rpmbuild .spec and can do what I need.

Cheers.

这篇关于Python distutils-更改路径RPM安装到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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