Blob Blame Raw
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%{!?py2_build: %global py2_build() %{__python2} setup.py build --executable="%{__python2} -s"}
%{!?py2_install: %global py2_install() %{__python2} setup.py install -O1 --skip-build --root %{buildroot}}
%{!?python_provide: %global python_provide Provides:       python-%{srcname} = %{version}-%{release}}

%global commit 252a308f2844f16f9ad77fd5a4e9da4c3f5f4c3c
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global srcname filelock
%global sum A platform independent file lock

Name:           python-%{srcname}
Version:        2.0.8
Release:        1%{?dist}
Summary:        %{sum}

Group:          Development/Libraries
License:        Unlicense
URL:            https://github.com/benediktschmitt/py-%{srcname}
Source0:        https://github.com/benediktschmitt/py-%{srcname}/archive/%{commit}.tar.gz#/%{srcname}-%{shortcommit}.tar.gz

BuildArch:      noarch

%description
This package contains a single module, which implements a platform independent
file locking mechanism for Python.

The lock includes a lock counter and is thread safe. This means, when locking
the same lock object twice, it will not block.

%package doc
Summary:        Documentation for %{srcname}, %{sum}
%if 0%{?rhel} <= 6
BuildRequires:  python-sphinx10
%else
BuildRequires:  python-sphinx
%endif
BuildRequires:  python-sphinx_rtd_theme
Requires:       fontawesome-fonts
%if 0%{?rhel} >= 7
Requires:       google-roboto-slab-fonts
%endif
Requires:       lato-fonts

%description doc
Documentation for %{srcname}, %{sum}

%package -n python2-%{srcname}
Summary:        %{sum}
BuildRequires:  python2-devel
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
This package contains a single module, which implements a platform independent
file locking mechanism for Python.

The lock includes a lock counter and is thread safe. This means, when locking
the same lock object twice, it will not block.

%prep
%autosetup -n py-%{srcname}-%{commit}

sed -i '1{\@^#!/usr/bin/python@d}' %{srcname}.py

%build
%py2_build

%if 0%{?rhel} <= 6
make -C docs html man SPHINXBUILD=sphinx-1.0-build
%else
make -C docs html man
%endif

rm docs/build/html/.buildinfo

# Unbundle fonts
ln -sf %{_datadir}/fonts/fontawesome/fontawesome-webfont.eot docs/build/html/_static/fonts/fontawesome-webfont.eot
ln -sf %{_datadir}/fonts/fontawesome/fontawesome-webfont.svg docs/build/html/_static/fonts/fontawesome-webfont.svg
ln -sf %{_datadir}/fonts/fontawesome/fontawesome-webfont.ttf docs/build/html/_static/fonts/fontawesome-webfont.ttf
ln -sf %{_datadir}/fonts/fontawesome/fontawesome-webfont.woff docs/build/html/_static/fonts/fontawesome-webfont.woff
%if 0%{?rhel} >= 7
ln -sf %{_datadir}/fonts/google-roboto-slab/RobotoSlab-Bold.ttf docs/build/html/_static/fonts/RobotoSlab-Bold.ttf
ln -sf %{_datadir}/fonts/google-roboto-slab/RobotoSlab-Regular.ttf docs/build/html/_static/fonts/RobotoSlab-Regular.ttf
%endif
ln -sf %{_datadir}/fonts/lato/Lato-Bold.ttf docs/build/html/_static/fonts/Lato-Bold.ttf
ln -sf %{_datadir}/fonts/lato/Lato-Regular.ttf docs/build/html/_static/fonts/Lato-Regular.ttf

%install
%py2_install

install -p -m0644 -D docs/build/man/py-%{srcname}.1 %{buildroot}%{_mandir}/man1/py-%{srcname}.1

%check
%{__python2} test.py

%files doc
%doc docs/build/html
%license LICENSE.rst

%files -n python2-%{srcname}
%doc README.rst
%license LICENSE.rst
%{_mandir}/man1/py-%{srcname}.1.gz
%{python2_sitelib}/%{srcname}.py
%{python2_sitelib}/%{srcname}.py[co]
%{python2_sitelib}/%{srcname}-%{version}-py?.?.egg-info

%changelog
* Sat Feb 04 2017 Scott K Logan <logans@cottsay.net> - 2.0.8-1
- Update to version 2.0.8

* Sun Oct 02 2016 Scott K Logan <logans@cottsay.net> - 2.0.6-2
- Remove google-roboto-slab-fonts from el6 dependencies

* Sun May 01 2016 Scott K Logan <logans@cottsay.net> - 2.0.6-1
- Initial package