Blob Blame History Raw
%if 0%{?fedora} < 15 || 0%{?rhel} < 7
%global need_argparse 1
%endif

%if ! (0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
%{!?pyver: %global pyver %(%{__python} -c "import sys ; print (sys.version[:3])")}

Summary:       Grep-like tool for source code
Name:          grin
Version:       1.2.1
Release:       12%{?dist}
License:       BSD
Group:         Applications/Text
URL:           http://pypi.python.org/pypi/grin
Source0:       http://pypi.python.org/packages/source/g/grin/%{name}-%{version}.tar.gz
Patch0:        grin-1.2.1-argparse.patch
Requires:      python-setuptools
%if 0%{?need_argparse}
Requires:      python-argparse
%endif
BuildArch:     noarch
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: python-setuptools python-nose

%description

grin is a similar in function to GNU grep, however it's has modified
behaviour to make it simpler to use when grepping source code.

Some features grin feature are:

  * recurse directories by default
  * do not go into directories with specified names
  * do not search files with specified extensions
  * be able to show context lines before and after matched lines
  * Python regex syntax
  * unless suppressed via a command line option, display the filename 
    regardless of the number of files
  * accept a file (or stdin) with a list of newline-separated filenames
  * grep through gzipped text files
  * be useful as a library to build custom tools quickly

%prep
%setup -q
%patch0 -p1
%{__chmod} 0644 examples/*
%{__sed} -i -e '1d' grin.py

%build
%{__python} setup.py build

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

%check
nosetests

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-, root, root, -)
%doc ANNOUNCE.txt examples LICENSE.txt README.txt THANKS.txt
%{_bindir}/%{name}
%{_bindir}/grind
%{python_sitelib}/%{name}.py*
%{python_sitelib}/%{name}-%{version}-py%{pyver}.egg-info/

%changelog
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-12
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Jun 30 2014 Toshio Kuratomi <toshio@fedoraproject.org> - 1.2.1-9
- Replace python-setuptools-devel BR with python-setuptools

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

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

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

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon May 09 2011 Terje Rosten <terje.rosten@ntnu.no> - 1.2.1-2
- Add patch to work with Python 2.7 and later
- Add argparse req. if needed

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sun Jan 30 2011 Terje Rosten <terje.rosten@ntnu.no> - 1.2.1-1
- 1.2.1

* Sun Dec 26 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.1.1-5
- Update python_sitelib macro
- Don't requires python-argparse (#665727)

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 1.1.1-4
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat Feb 21 2009 Terje Rosten <terje.rosten@ntnu.no> - 1.1.1-2
- add docs
- rpmlint clean
- add %%check section

* Sat Jan 17 2009 Terje Rosten <terje.rosten@ntnu.no> - 1.1.1-1
- initial build