Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

%global modname tbgrep

Name:             python-tbgrep
Version:          0.3.0
Release:          2%{?dist}
Summary:          Extract Python Tracebacks from text

Group:            Development/Libraries
License:          GPLv3+
URL:              http://pypi.python.org/pypi/tbgrep
Source0:          http://pypi.python.org/packages/source/t/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:        noarch


BuildRequires:    python2-devel
BuildRequires:    python-nose

%if 0%{?with_python3}
BuildRequires:    python3-devel
BuildRequires:    python3-nose
%endif

%description
A module & command-line tool for extracting Python tracebacks from text.

    $ tbgrep file1 file2 file3
    $ tail -f logfile | tbgrep

tbgrep can extract tracebacks from logs of various formats. For example,
CherryPy starts the traceback on a line with other details (like module,
timestamp, etc), but the rest of the trace starts at the beginning of the
line. Apache logs, on the other hand, will prefix each line of the
traceback with this information. tbgrep is designed to these kinds of
situations

%if 0%{?with_python3}
%package -n python3-tbgrep
Summary:        Extract Python Tracebacks from text
Group:          Development/Libraries

%description -n python3-tbgrep
A module & command-line tool for extracting Python tracebacks from text.

    $ tbgrep file1 file2 file3
    $ tail -f logfile | tbgrep

tbgrep can extract tracebacks from logs of various formats. For example,
CherryPy starts the traceback on a line with other details (like module,
timestamp, etc), but the rest of the trace starts at the beginning of the
line. Apache logs, on the other hand, will prefix each line of the
traceback with this information. tbgrep is designed to these kinds of
situations
%endif

%prep
%setup -q -n %{modname}-%{version}

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
mv %{buildroot}/%{_bindir}/tbgrep %{buildroot}/%{_bindir}/python3-tbgrep
popd
%endif

%{__python} setup.py install -O1 --skip-build --root=%{buildroot}

%check
%{__python} setup.py test

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif


%files
%doc README.rst LICENSE
%{python_sitelib}/%{modname}
%{python_sitelib}/%{modname}-%{version}*
%{_bindir}/tbgrep

%if 0%{?with_python3}
%files -n python3-%{modname}
%doc README.rst LICENSE
%{python3_sitelib}/%{modname}
%{python3_sitelib}/%{modname}-%{version}-*
%{_bindir}/python3-tbgrep
%endif


%changelog
* Fri Mar 27 2015 Ralph Bean <rbean@redhat.com> - 0.3.0-2
- Fix the with_python3 conditional.

* Fri Jan 30 2015 Luke Macken <lmacken@redhat.com> - 0.3.0-1
- Update to 0.3.0

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 0.2.3-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Jul 22 2013 Luke Macken <lmacken@redhat.com> - 0.2.3-1
- Enable python3 support
- Update to 0.2.3

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sun Aug 12 2012 Ralph Bean <rbean@redhat.com> - 0.2.2-1
- Latest upstream, includes LICENSE
* Sun Aug 12 2012 Ralph Bean <rbean@redhat.com> - 0.2.0-1
- Initial package for Fedora