Python distutils - Change Path RPM Installs To

南楼画角 提交于 2019-12-13 04:59:20

问题


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.


回答1:


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.




回答2:


See this answer: https://stackoverflow.com/a/6220687/725021

You should try the install-lib paramater of the [install] section in setup.cfg.



来源:https://stackoverflow.com/questions/26411602/python-distutils-change-path-rpm-installs-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!