5eea759
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
5eea759
5eea759
%define real_name line_profiler
5eea759
%define pre_release b2
5eea759
5eea759
Name:           python-%{real_name}
5eea759
Version:        1.0
5eea759
Release:        0.3.%{pre_release}%{?dist}
5eea759
Summary:        A Python line-by-line profiler
5eea759
5eea759
Group:          Development/Languages
5eea759
License:        BSD
5eea759
URL:            http://packages.python.org/%{real_name}
5eea759
Source0:        http://pypi.python.org/packages/source/l/%{real_name}/%{real_name}-%{version}%{pre_release}.tar.gz
5eea759
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
5eea759
5eea759
BuildRequires:  python-devel
5eea759
5eea759
%description
5eea759
line_profiler will profile the time individual lines of code take to execute.
5eea759
5eea759
%prep
5eea759
%setup -q -n %{real_name}-%{version}%{pre_release}
5eea759
5eea759
# Fix non-executable-script error
5eea759
%{__sed} -i '/^#!\/usr\/bin\/env\ python/d' %{real_name}.py
5eea759
5eea759
%build
5eea759
CFLAGS="%{optflags}" %{__python} setup.py build
5eea759
5eea759
%install
5eea759
rm -rf %{buildroot}
5eea759
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
5eea759
5eea759
# Fix non-standard-executable-perm error
5eea759
chmod 0755 %{buildroot}%{python_sitearch}/_%{real_name}.so
5eea759
5eea759
# Rename kernprof.py to fix various .py bindir issues
5eea759
mv %{buildroot}%{_bindir}/kernprof.py %{buildroot}%{_bindir}/kernprof
5eea759
5eea759
%clean
5eea759
rm -rf %{buildroot}
5eea759
5eea759
%files
5eea759
%defattr(-,root,root,-)
5eea759
%doc LICENSE.txt PKG-INFO README.txt
5eea759
%{_bindir}/kernprof
5eea759
%{python_sitearch}/_%{real_name}.so
5eea759
%{python_sitearch}/%{real_name}-*.egg-info
5eea759
%{python_sitearch}/%{real_name}.py*
5eea759
5eea759
%changelog
5eea759
* Mon Jun 01 2009 Silas Sewell <silas@sewell.ch> - 1.0-0.3.b2
5eea759
- Rename kernprof.py to kernprof
5eea759
5eea759
* Fri May 29 2009 Silas Sewell <silas@sewell.ch> - 1.0-0.2.b2
5eea759
- Remove pyc and pyo exclude for bindir as Koji doesn't create them
5eea759
5eea759
* Wed May 27 2009 Silas Sewell <silas@sewell.ch> - 1.0-0.1.b2
5eea759
- Initial build