Blob Blame History Raw
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

# This package installs two private shared libraries, don't 'provide' them
%global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so)$

Name:           python-djvulibre
Version:        0.3.9
Release:        7%{?dist}
Summary:        Python bindings for the DjVuLibre library
Group:          Development/Libraries

License:        GPLv2
URL:            http://jwilk.net/software/python-djvulibre
Source0:        https://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz

BuildRequires:  python2-devel djvulibre-libs djvulibre-devel Cython
BuildRequires:  python-docutils
BuildRequires:  python-nose

%if 0%{?rhel} && 0%{?rhel} <=6
# Use Sphinx10 on EL <= 6
BuildRequires:  python-sphinx10
# python-sphinx10 doesn't set sys.path correctly; do it for them
%global pythonpath %(find %{python2_sitelib} -name Sphinx*.egg)
%else
BuildRequires:  python-sphinx >= 1.0
%endif 

%description
python-djvulibre is a set of Python bindings for the DjVuLibre library, an open
source implementation of DjVu

%package doc
Summary:        Documentation for python-djvulibre
Group:          Documentation
Buildarch:      noarch
Requires:       %{name} = %{version}-%{release}

%description doc
Documentation for python-djvulibre

%prep
%setup -q


%build
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
%{?pythonpath: PYTHONPATH="%{pythonpath}"} \
    %{__python2} setup.py build_sphinx

# Fix wrong EOL markers in documentation
sed -i 's/\r$//' build/sphinx/html/_static/jquery.js
 
# Make sure scripts in the examples directory aren't executable
%{__chmod} 0644 examples/*

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

# Fix non-standard (0775) executable permissions on private shared libraries
%{__chmod} 0755 %{buildroot}%{python2_sitearch}/djvu/sexpr.so
%{__chmod} 0755 %{buildroot}%{python2_sitearch}/djvu/decode.so

%check
LC_ALL='en_US.UTF-8' %{__python2} setup.py nosetests

%files
# For arch-specific packages: sitearch
%doc COPYING doc/changelog doc/credits.txt
%{python2_sitearch}/*

%files doc
%doc build/sphinx/html/* examples

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

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.9-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.9-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Tue Jul 15 2014 Brian Stinson <bstinson@ksu.edu> - 0.3.9-3
- Change to using consistent buildroot tags, since DjVulibre isn't packaged for
  el5, we don't need to explicitly remove the buildroot in the install step
- Split out examples and documentation into a subpackage
- Add a check step to run nosetests

* Mon Jul 14 2014 Brian Stinson <bstinson@ksu.edu> - 0.3.9-2
- Incorporate suggested macro removals and changes from jduncan and cicku

* Sun Jul 13 2014 Brian Stinson <bstinson@ksu.edu> - 0.3.9-1
- Initial Build