Blob Blame History Raw
# Created by pyp2rpm-3.3.2
%global pypi_name hyperlink

%global common_description %{expand:
The humble, but powerful, URL runs everything around us. Chances are you've
used several just to read this text. Hyperlink is a featureful, pure-Python
implementation of the URL, with an emphasis on correctness.}

Name:           python-%{pypi_name}
Version:        18.0.0
Release:        1%{?dist}
Summary:        A featureful, immutable, and correct URL for Python

# MIT: main library
# BSD: searchtools.js, websupport.js and modernizr.min.js
# OFL: Inconsolata-Regular.ttf and Inconsolata-Bold.ttf
License:        MIT and BSD and OFL
URL:            https://github.com/python-hyper/hyperlink
Source0:        https://files.pythonhosted.org/packages/source/h/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch
 
BuildRequires:  python2-devel
BuildRequires:  python2dist(idna) >= 2.5
BuildRequires:  python2dist(setuptools)
 
BuildRequires:  python3-devel
BuildRequires:  python3dist(idna) >= 2.5
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(sphinx)

# Unbundle fonts and JS
BuildRequires:  fontawesome-fonts
BuildRequires:  fontawesome-fonts-web
BuildRequires:  lato-fonts
BuildRequires:  google-roboto-slab-fonts
BuildRequires:  js-underscore
BuildRequires:  js-jquery

%{?python_enable_dependency_generator}

%description
%{common_description}


%package -n     python2-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-%{pypi_name}
%{common_description}


%package -n     python3-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pypi_name}
%{common_description}


%package doc
Summary:        Documentation for %{name}

Requires:  fontawesome-fonts
Requires:  fontawesome-fonts-web
Requires:  lato-fonts
Requires:  google-roboto-slab-fonts
Requires:  js-underscore
Requires:  js-jquery

%description doc
%{common_description}

This is the documentation package for hyperlink.


%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info


%build
%py2_build
%py3_build

# generate html docs 
PYTHONPATH=${PWD} sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

# Unbundle fonts
pushd html/_static/fonts/
for file in fontawesome*; do
    rm -f $file
    ln -s /usr/share/fonts/fontawesome/$file $file
done
for file in Lato*; do
    rm -f $file
    ln -s /usr/share/fonts/lato/$file $file
done
for file in RobotoSlab*; do
    rm -f $file
    ln -s /usr/share/fonts/google-roboto-slab/$file $file
done
popd

# Unbundle JS
rm -f html/_static/underscore.js
ln -s /usr/share/javascript/underscore/underscore-min.js html/_static/underscore.js
rm -f html/_static/underscore-1.3.1.js
ln -s /usr/share/javascript/underscore/underscore.js html/_static/underscore-1.3.1.js
rm -f html/_static/jquery.js
ln -s /usr/share/javascript/jquery/3.2.1/jquery.min.js html/_static/jquery.js
rm -f html/_static/jquery-3.2.1.js
ln -s /usr/share/javascript/jquery/3.2.1/jquery.js html/_static/jquery-3.2.1.js


%install
%py2_install
%py3_install


%check
%{__python2} setup.py test
%{__python3} setup.py test


%files -n python2-%{pypi_name}
%license LICENSE
%doc README.md
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info


%files -n python3-%{pypi_name}
%license LICENSE
%doc README.md
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info


%files doc
%doc html
%license LICENSE


%changelog
* Mon May 14 2018 Robert-André Mauchin <zebob.m@gmail.com> - 18.0.0-1
- Initial package.