Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

Python distutils - Change Path RPM Installs To

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 <[email protected]>
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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...