File python-agrepy.spec of Package python-agrepy

#
# spec file for package python-agrepy
#
# Copyright (c) 2013 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-agrepy
Version:        1.2
Release:        0
Summary:        Python Bindings for agrep
License:        Foo
Group:          Development/Libraries/Python
Source:         agrepy_%{version}.tar.bz2
Patch1:         makefile_for_py27_gcc45.patch
Url:            http://pam1.bcs.uwa.edu.au/~michaelw/pyagrep.html
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  glibc-devel
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  swig
%py_requires
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

%description
This port takes agrep from its current, user level setting and makes it
available as a Python module. 

%prep
%setup -q -n "agrepy_%{version}"
%patch1 -p1
sed -i "1d" agrepy.py # Fix non-executable script

%build
PYTHON_VERSION="%py_ver" PYTHONROOT="%py_prefix" \
CFLAGS="%{optflags} -DPYTHON -fPIC -I/usr/include/python%py_ver -w" \
LDFLAGS="-L%_libdir -shared -lpython%py_ver -lm -dl" make

%install
install -D _agrepy.so %{buildroot}%{python_sitearch}/agrepy/_agrepy.so
install agrepy.py %{buildroot}%{python_sitearch}/agrepy/agrepy.py
echo "from agrepy import *" > %{buildroot}%{python_sitearch}/agrepy/__init__.py

%files
%defattr(-,root,root,-)
%doc COPYRIGHT.agrep README
%{python_sitearch}/*

%changelog
openSUSE Build Service is sponsored by