595ba5e
%{!?__python2: %global __python2 /usr/bin/python2}
595ba5e
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
595ba5e
%{!?py2_build: %global py2_build() %{__python2} setup.py build --executable="%{__python2} -s"}
595ba5e
%{!?py2_install: %global py2_install() %{__python2} setup.py install -O1 --skip-build --root %{buildroot}}
595ba5e
%{!?python_provide: %global python_provide Provides:       python-%{srcname} = %{version}-%{release}}
595ba5e
595ba5e
%global commit fde6c13718dd98ca50a9e3378f972706035b57c6
595ba5e
%global shortcommit %(c=%{commit}; echo ${c:0:7})
595ba5e
%global srcname filelock
595ba5e
%global sum A platform independent file lock
595ba5e
595ba5e
Name:           python-%{srcname}
595ba5e
Version:        2.0.6
595ba5e
Release:        1%{?dist}
595ba5e
Summary:        %{sum}
595ba5e
595ba5e
Group:          Development/Libraries
595ba5e
License:        Unlicense
595ba5e
URL:            https://github.com/benediktschmitt/py-%{srcname}
595ba5e
Source0:        https://github.com/benediktschmitt/py-%{srcname}/archive/%{commit}.tar.gz#/%{srcname}-%{shortcommit}.tar.gz
595ba5e
595ba5e
BuildArch:      noarch
595ba5e
595ba5e
%description
595ba5e
This package contains a single module, which implements a platform independent
595ba5e
file locking mechanism for Python.
595ba5e
595ba5e
The lock includes a lock counter and is thread safe. This means, when locking
595ba5e
the same lock object twice, it will not block.
595ba5e
595ba5e
%package doc
595ba5e
Summary:        Documentation for %{srcname}, %{sum}
595ba5e
%if 0%{?rhel} <= 6
595ba5e
BuildRequires:  python-sphinx10
595ba5e
%else
595ba5e
BuildRequires:  python-sphinx
595ba5e
%endif
595ba5e
BuildRequires:  python-sphinx_rtd_theme
595ba5e
Requires:       fontawesome-fonts
595ba5e
Requires:       google-roboto-slab-fonts
595ba5e
Requires:       lato-fonts
595ba5e
595ba5e
%description doc
595ba5e
Documentation for %{srcname}, %{sum}
595ba5e
595ba5e
%package -n python2-%{srcname}
595ba5e
Summary:        %{sum}
595ba5e
BuildRequires:  python2-devel
595ba5e
%{?python_provide:%python_provide python2-%{srcname}}
595ba5e
595ba5e
%description -n python2-%{srcname}
595ba5e
This package contains a single module, which implements a platform independent
595ba5e
file locking mechanism for Python.
595ba5e
595ba5e
The lock includes a lock counter and is thread safe. This means, when locking
595ba5e
the same lock object twice, it will not block.
595ba5e
595ba5e
%prep
595ba5e
%autosetup -n py-%{srcname}-%{commit}
595ba5e
595ba5e
sed -i '1{\@^#!/usr/bin/python@d}' %{srcname}.py
595ba5e
595ba5e
%build
595ba5e
%py2_build
595ba5e
595ba5e
%if 0%{?rhel} <= 6
595ba5e
make -C docs html man SPHINXBUILD=sphinx-1.0-build
595ba5e
%else
595ba5e
make -C docs html man
595ba5e
%endif
595ba5e
595ba5e
rm docs/build/html/.buildinfo
595ba5e
595ba5e
# Unbundle fonts
595ba5e
ln -sf %{_datadir}/fonts/fontawesome/fontawesome-webfont.eot docs/build/html/_static/fonts/fontawesome-webfont.eot
595ba5e
ln -sf %{_datadir}/fonts/fontawesome/fontawesome-webfont.svg docs/build/html/_static/fonts/fontawesome-webfont.svg
595ba5e
ln -sf %{_datadir}/fonts/fontawesome/fontawesome-webfont.ttf docs/build/html/_static/fonts/fontawesome-webfont.ttf
595ba5e
ln -sf %{_datadir}/fonts/fontawesome/fontawesome-webfont.woff docs/build/html/_static/fonts/fontawesome-webfont.woff
595ba5e
ln -sf %{_datadir}/fonts/google-roboto-slab/RobotoSlab-Bold.ttf docs/build/html/_static/fonts/RobotoSlab-Bold.ttf
595ba5e
ln -sf %{_datadir}/fonts/google-roboto-slab/RobotoSlab-Regular.ttf docs/build/html/_static/fonts/RobotoSlab-Regular.ttf
595ba5e
ln -sf %{_datadir}/fonts/lato/Lato-Bold.ttf docs/build/html/_static/fonts/Lato-Bold.ttf
595ba5e
ln -sf %{_datadir}/fonts/lato/Lato-Regular.ttf docs/build/html/_static/fonts/Lato-Regular.ttf
595ba5e
595ba5e
%install
595ba5e
%py2_install
595ba5e
595ba5e
install -p -m0644 -D docs/build/man/py-%{srcname}.1 %{buildroot}%{_mandir}/man1/py-%{srcname}.1
595ba5e
rm %{buildroot}%{_prefix}/LICENSE.rst %{buildroot}%{_prefix}/README.rst
595ba5e
595ba5e
%check
595ba5e
%{__python2} test.py
595ba5e
595ba5e
%files doc
595ba5e
%doc docs/build/html
595ba5e
%license LICENSE.rst
595ba5e
595ba5e
%files -n python2-%{srcname}
595ba5e
%doc README.rst
595ba5e
%license LICENSE.rst
595ba5e
%{_mandir}/man1/py-%{srcname}.1.gz
595ba5e
%{python2_sitelib}/%{srcname}.py
595ba5e
%{python2_sitelib}/%{srcname}.py[co]
595ba5e
%{python2_sitelib}/%{srcname}-%{version}-py?.?.egg-info
595ba5e
595ba5e
%changelog
595ba5e
* Sun May 01 2016 Scott K Logan <logans@cottsay.net> - 2.0.6-1
595ba5e
- Initial package