Blob Blame History Raw
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 0
%endif

# Re-enable Python 3 support once the following are resolved:
# https://github.com/mitsuhiko/logbook/issues/42
# https://github.com/mitsuhiko/logbook/issues/43

# we don't want to provide private python extension libs
%{?filter_setup:
%filter_provides_in %{python_sitearch}/.*\.so$ 
%filter_provides_in %{python3_sitearch}/.*\.so$ 
%filter_setup
}

Name:		python-logbook
Version:	0.4.1
Release:	1%{?dist}
Summary:	A logging replacement for Python

Group:		Development/Libraries
License:	BSD
URL:		http://pypi.python.org/pypi/Logbook/
Source0:	http://pypi.python.org/packages/source/L/Logbook/Logbook-%{version}.tar.gz
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	python2-devel
BuildRequires:	python-sqlalchemy python-zmq python-execnet python-jinja2
%if 0%{?with_python3}
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-sqlalchemy python3-zmq
%endif
BuildRequires:	python-setuptools

%description
Logbook is a logging system for Python that replaces the standard library’s
logging module. It was designed with both complex and simple applications
and mind and the idea to make logging fun. What makes it fun? What about 
getting log messages on your phone or desktop notification system? 
Logbook can do that.


%if 0%{?with_python3}
%package -n python3-logbook
Summary:	A logging replacement for Python 3
Group:		Development/Libraries

%description -n python3-logbook
Logbook is a logging system for Python that replaces the standard library’s
logging module. It was designed with both complex and simple applications
and mind and the idea to make logging fun. What makes it fun? What about 
getting log messages on your phone or desktop notification system? 
Logbook can do that.

This package allows for use of logger with Python 3.
%endif # with_python3

%prep
%setup -qn Logbook-%{version}


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

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%endif # with_python3

%install
rm -rf %{buildroot}
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python} setup.py install --skip-build --root %{buildroot} \
	--install-data=%{_datadir}

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


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc CHANGES README
%{python_sitearch}/logbook*
%exclude %{python_sitearch}/logbook/testsuite
%{python_sitearch}/Logbook-%{version}-py2.7.egg-info/

%if 0%{?with_python3}
%files -n python3-logbook
%defattr(-,root,root,-)
%doc CHANGES README
%{python3_sitearch}/logbook*
%exclude %{python3_sitearch}/logbook/testsuite
%{python3_sitearch}/Logbook-%{version}-py3.2.egg-info/
%endif

%changelog
* Mon Jan 28 2013 Jon Ciesla <limb@jcomserv.net> - 0.4.1-1
- Latest upstream, BZ 904886.

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

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

* Fri Oct 28 2011 Jon Ciesla <limb@jcomserv.net> - 0.3-3
- Dropped test suite from Python 3 package.
- Testing via setuptools.
- Filtered .so in Python 3 package.
- Dropped Python 3 subpackage, see comments.
- Added python-jinja2 BR.

* Wed Oct 26 2011 Jon Ciesla <limb@jcomserv.net> - 0.3-2
- Ownership and macro fixes.
- Dropped spurious Requires.
- Added test suite to check, dropped from package.

* Tue Oct 11 2011 Jon Ciesla <limb@jcomserv.net> - 0.3-1
- Initial RPM release