开发者

Setting the RPM Package name in bdist_rpm

开发者 https://www.devze.com 2023-03-29 13:49 出处:网络
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

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:

  1. rename the spec file to [newname].spec
  2. change every occurence of %{name} with [newname]
  3. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号