在bdist_rpm中设置RPM包名称

发布于 2024-11-30 23:36:28 字数 171 浏览 2 评论 0原文

我正在使用 Python setuptools 来构建包。由于一些命名限制,我想将使用 bdist_rpm 选项构建的 rpm 命名为与 Python 包名称不同的名称。

可以在[bdist_rpm]部分的setup.cfg中完成吗?

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 restrictions.

Can it be done in the setup.cfg in the [bdist_rpm] section?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甩你一脸翔 2024-12-07 23:36:28

fpm 工具可以轻松生成 RPM 包并更改名称或其他参数。默认情况下,fpm 使 RPM 带有“python- 前缀名称,但可以使用 -n 参数设置包名称。示例:

fpm -s python -t rpm -n my_package_name <python-source-library>/setup.py

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
二智少女 2024-12-07 23:36:28

嗯,它确实有点不标准,因此不直接支持。但是,您可以执行 python setup.py bdist_rpm --spec-only ,这将在 dist/ 内生成一个名为 project.spec 的规范文件,如下所示:

%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

要从此处成功构建 rpm,您需要:

  1. 将规范文件重命名为 [newname].spec
  2. 将每次出现的 %{name} 更改为 [newname]
  3. rpmbuild -ba [newname.spec] (将文件放入 rpmbuild 会找到它们的目录后)

我相信您可以自动执行此操作如果你真的想以某种方式

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文