Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python bdist_rpm -ba: unknown option error: command 'rpm' failed with exit status 1

Tags:

python

rpm

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?

Error:

bdist_rpm -ba: unknown option error: command 'rpm' failed with exit status 1

I'm running the following python setup.py script:

setup(
    name='Tester',
    version='0.1.0',
    author='My Name',
    author_email='[email protected]',
    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",
    ],
)

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 <[email protected]>

%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)
like image 486
c12 Avatar asked Apr 02 '13 21:04

c12


1 Answers

Just run:

yum install rpm-build

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.

like image 126
GuerillaNerd Avatar answered Nov 09 '22 05:11

GuerillaNerd