2010-10-11

Simple Twisted RPM Spec File

I needed to build twisted for RHEL5 (Really, centos5, but who cares, they’re the same thing with different lawyers).
This is a really simple spec file that lets me build the dratted thing with a minimum of fuss. Twisted tarball is the one from http://twistedmatrix.com/trac/wiki/Downloads.
%define name python-twisted
%define version 10.1.0
%define release 1
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Summary: Event-based framework for internet applications
Name: %{name}
Version: %{version}
Release: %{release}
Source0: Twisted-%{version}.tar.bz2
License: MIT
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: i386
Vendor: Your Name
Url: http://twistedmatrix.com/
BuildRequires: python-devel
Requires: python
Requires: python-zope-interface
Obsoletes: python-twisted-core
%description
See summary.
%prep
%setup -q -c
%build
cd Twisted-10.1.0
%{__python} setup.py build
%install
cd Twisted-10.1.0
%{__python} setup.py install --root=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{python_sitelib}/twisted
%{_bindir}