从Ubuntu到CentOs的bdist_rpm

时间:2011-06-02 20:58:27

标签: python ubuntu centos rpm

我们在Ubuntu / Mac上开发并将RPM部署到CentOS(这是设置,不能改变太多)。

问题是从rpm安装时,包转到/usr/local/lib/python2.7/dist-packages(这是Ubuntu的正确位置)。但是,CentOS中的默认python路径是/usr/local/lib/python2.7/site-packages

有没有办法告诉bdist_rpm将文件安装到哪里?

1 个答案:

答案 0 :(得分:9)

您可以使用setup.cfg文件覆盖Python lib安装路径:

<强> setup.cfg

[install]
install-lib=/usr/local/lib/python2.7/site-packages

示例:

% python setup.py bdist_rpm
% rpm -qpl dist/foo-0.0.0-1.noarch.rpm | grep foo

/usr/local/lib/python2.7/site-packages/foo/__init__.py
/usr/local/lib/python2.7/site-packages/foo/__init__.pyc