Setting the RPM Package name in bdist_rpm
I am using Python setuptools for building a package. I would like to name the rpm built from bdist_rpm
option to be different than the Python package name due to some naming rest开发者_如何学Crictions.
Can it be done in the setup.cfg
in the [bdist_rpm]
section?
The fpm tool makes easy to generate the RPM package and change the name or another parameter. By default, fpm makes the RPM with "python- prefix name, but the package name can be set with -n parameter. An example:
fpm -s python -t rpm -n my_package_name <python-source-library>/setup.py
Well it is indeed a slightly non-standard and so not directly supported. You can however do python setup.py bdist_rpm --spec-only
and this will generate a spec file inside dist/ named project.spec, starting like this:
%define name [name of your pkg as defined in setup.py]
%define version [version of your pkg]
%define unmangled_version [version of your pkg]
%define release 1
Summary: PyQt4 application to download trailers from www.apple.com/trailers
Name: %{name} # THIS IS WHAT YOU WANT TO CHANGE
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
To succesfully build rpm from here you need to:
- rename the spec file to [newname].spec
- change every occurence of %{name} with [newname]
- rpmbuild -ba [newname.spec] (after putting files in dirs where rpmbuild will find them)
I am sure you could automate this in some way if you really wanted to
精彩评论