File python-grin.spec of Package python-grin

#
# spec file for package python-grin
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           python-grin
Version:        1.2.1
Release:        0
Url:            http://pypi.python.org/pypi/grin/
Summary:        A grep program configured the way I like it
License:        BSD
Group:          Development/Languages/Python
Source:         http://pypi.python.org/packages/source/g/grin/grin-%{version}.tar.gz
%if 0%{?py_version} >= 270
Patch0:         python2.7.diff
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  python-devel
BuildRequires:  python-setuptools
%if 0%{?suse_version}
%py_requires
%if 0%{?suse_version} > 1110
BuildArch:      noarch
%endif
%endif
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

%description
I wrote grin to help me search directories full of source code. The venerable
GNU grep_ and find_ are great tools, but they fall just a little short for my
normal use cases. I wrote grin to get exactly the features I wanted:

  * 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 (one can quibble as to whether this is a feature or my
    laziness for using the regex library provided with my implementation
    language, but as a Python programmer, this is the syntax I am most familiar
    with).
  * 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. This
    allows one to use find_ to feed grin a list of filenames which might have
    embedded spaces quite easily.
  * Grep through gzipped text files.
  * Be useful as a library to build custom tools quickly.

%prep
%setup -q -n grin-%{version}
echo %{py_version}
%if 0%{?py_version} >= 270
%patch0
%endif
sed -i "1d" grin.py # Fix non-executable script

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

%files
%defattr(-,root,root,-)
%doc ANNOUNCE.txt LICENSE.txt README.txt THANKS.txt
%{_bindir}/grin*
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by