Python bdist_rpm -ba:未知选项错误:命令“rpm"失败,退出状态为 1 [英] Python bdist_rpm -ba: unknown option error: command 'rpm' failed with exit status 1
问题描述
我在尝试为我的 Linux 发行版构建 Python RPM 包时遇到以下错误.我在过程中看到警告,但我认为这些与-ba:未知错误"无关,有什么想法可以让它运行吗?
I'm getting the following error when trying to build a Python RPM package for my Linux distribution. I see warnings in the process but I don't think those have to do with the "-ba: unknown error", any ideas how to get this to run?
错误:
bdist_rpm -ba: unknown option error: command 'rpm' failed with exit status 1
我正在运行以下 python setup.py 脚本:
I'm running the following python setup.py script:
setup(
name='Tester',
version='0.1.0',
author='My Name',
author_email='emailaddress@gmail.com',
packages=['tester'],
license='LICENSE.txt',
description='IMAP Email Reader.',
long_description=open('README.txt').read(),
install_requires=[
"Django >= 1.1.1",
"caldav == 0.1.4",
],
)
当我运行 python setup.py bdist_rpm 时,它会在 ~/Tester/build/bdist.linux-x86_64/rpm/SPECS 目录中创建一个 Tester.spec 文件
:
when I run python setup.py bdist_rpm it creates a Tester.spec file in the ~/Tester/build/bdist.linux-x86_64/rpm/SPECS directory
:
%define name Tester
%define version 0.1.0
%define unmangled_version 0.1.0
%define release 1
Summary: Email Reader.
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
License: LICENSE.txt
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: My Name <emailaddress@gmail.com>
%description
%prep
%setup -n %{name}-%{unmangled_version}
%build
python setup.py build
%install
python setup.py install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
%clean
rm -rf $RPM_BUILD_ROOT
%files -f INSTALLED_FILES
%defattr(-,root,root)
推荐答案
只需运行:
yum install rpm-build
看来,如果 rpmbuild 命令不可用,setuptools 会回退到使用rpm"命令,它(据我所知)很久以前就内置了 rpmbuild 功能,但此后已被分离.因此,安装 rpm-build 包会使 rpmbuild 命令可用,并且 setuptools 在构建包时会使用它.
It appears that if the rpmbuild command is not available, setuptools falls back to usig the "rpm" command, which (as I understand it) had the rpmbuild functionality built in long, long ago but has since beeen separated. So, installing the rpm-build package makes the rpmbuild command available and setuptools uses it when it is building your package.
这篇关于Python bdist_rpm -ba:未知选项错误:命令“rpm"失败,退出状态为 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!