Blob Blame History Raw
%global pypi_name XStatic-roboto-fontface

%if 0%{?fedora}
%global with_python3 1
%endif

Name:           python-%{pypi_name}
Version:        0.5.0.0
Release:        6%{?dist}
Summary:        roboto-fontface (XStatic packaging standard)

License:        ASL 2.0
URL:            https://github.com/choffmeister/roboto-fontface-bower
Source0:        https://pypi.io/packages/source/X/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

%description
XStatic-roboto-fontface is a roboto-fontface JavaScript
library packaged for setuptools (easy_install) / pip.

This package is intended to be used by any project that needs these files.
It intentionally does not provide any extra code except some metadata nor
has any extra requirements.

%package -n python2-%{pypi_name}
Summary:        roboto-fontface (XStatic packaging standard)

%{?python_provide:%python_provide python2-%{pypi_name}}

BuildRequires:  python2-devel
BuildRequires:  python2-setuptools

Requires:    python2-XStatic
Requires:    roboto-fontface-common = %{version}-%{release}
Requires:    roboto-fontface-fonts  = %{version}-%{release}

%description -n python2-%{pypi_name}
XStatic-roboto-fontface is a roboto-fontface JavaScript
library packaged for setuptools (easy_install) / pip.

This package is intended to be used by any project that needs these files.
It intentionally does not provide any extra code except some metadata nor
has any extra requirements.

%package -n roboto-fontface-common
Summary:    roboto-fontface commons
BuildRequires:  web-assets-devel

Requires:       web-assets-filesystem

%description -n roboto-fontface-common
Common roboto-fontface static content (font, CSS and SCSS)

# TODO
# use google-roboto-font instead of roboto-fontface-fonts
# currently google-roboto-font does not have .eot, .svg and .woff files
# reference: https://bugzilla.redhat.com/show_bug.cgi?id=1261022

%package -n roboto-fontface-fonts
Summary:    roboto-fontface fonts
BuildRequires:  fontpackages-filesystem

Requires:       fontpackages-filesystem

%description -n roboto-fontface-fonts
roboto-fontface fonts

#python3 packaging
%if 0%{?with_python3}
%package -n     python3-%{pypi_name}
Summary:        roboto-fontface (XStatic packaging standard)
%{?python_provide:%python_provide python3-%{pypi_name}}

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools

Requires:    python3-XStatic
Requires:    roboto-fontface-common = %{version}-%{release}
Requires:    roboto-fontface-fonts  = %{version}-%{release}

%description -n python3-%{pypi_name}
XStatic-roboto-fontface is a roboto-fontface JavaScript
library packaged for setuptools (easy_install) / pip.

This package is intended to be used by any project that needs these files.
It intentionally does not provide any extra code except some metadata nor
has any extra requirements.
%endif

%prep
%setup -q -n %{pypi_name}-%{version}

sed -i "s|^BASE_DIR = .*|BASE_DIR = '%{_jsdir}/roboto_fontface'|" xstatic/pkg/roboto_fontface/__init__.py

%build
%{__python2} setup.py build

%if 0%{?with_python3}
%{__python3} setup.py build
%endif

%install
%{__python2} setup.py install --skip-build --root %{buildroot}
# Move fonts to the right directory
mkdir -p %{buildroot}/%{_datadir}/fonts/roboto_fontface
mv %{buildroot}/%{python2_sitelib}/xstatic/pkg/roboto_fontface/data/fonts/* %{buildroot}/%{_datadir}/fonts/roboto_fontface

# Fix shebang issues
for file in %{buildroot}/%{_datadir}/fonts/roboto_fontface/roboto/*.svg; do
 chmod -x $file
done

# Move static files
mkdir -p %{buildroot}/%{_jsdir}/roboto_fontface/css
mv %{buildroot}/%{python2_sitelib}/xstatic/pkg/roboto_fontface/data/css/* %{buildroot}/%{_jsdir}/roboto_fontface/css
rm -rf %{buildroot}/%{python2_sitelib}/xstatic/pkg/roboto_fontface/data
# link fonts
mkdir %{buildroot}/%{_jsdir}/roboto_fontface/fonts
pushd %{buildroot}/%{_jsdir}/roboto_fontface/fonts
ln -s ../../../fonts/roboto_fontface/* .
popd


%if 0%{?with_python3}
%{__python3} setup.py install --skip-build --root %{buildroot}
# Remove static files, already created by the python2 subpkg
rm -rf %{buildroot}/%{python3_sitelib}/xstatic/pkg/roboto_fontface/data
%endif

%files -n python2-%{pypi_name}
%doc README.txt
%{python2_sitelib}/xstatic/pkg/roboto_fontface
%{python2_sitelib}/XStatic_roboto_fontface-%{version}-py?.?.egg-info
%{python2_sitelib}/XStatic_roboto_fontface-%{version}-py?.?-nspkg.pth

%files -n roboto-fontface-common
%doc README.txt
%{_jsdir}/roboto_fontface

%files -n roboto-fontface-fonts
%doc README.txt
%{_datadir}/fonts/roboto_fontface

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.txt
%{python3_sitelib}/xstatic/pkg/roboto_fontface
%{python3_sitelib}/XStatic_roboto_fontface-%{version}-py?.?.egg-info
%{python3_sitelib}/XStatic_roboto_fontface-%{version}-py?.?-nspkg.pth
%endif

%changelog
* Fri Feb 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.5.0.0-6
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.5.0.0-2
- Rebuild for Python 3.6

* Tue Nov 22 2016 Haïkel Guémar <hguemar@fedoraproject.org> - 0.5.0.0-1
- Upstream 0.5.0.0

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

* Thu May 12 2016 Matthias Runge <mrunge@redhat.com> - 0.4.3.2-8
- fix font location for xstatic package (rhbz#1333600)

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

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.3.2-5
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Tue Sep 22 2015 Matthias Runge <mrunge@redhat.com> - 0.4.3.2-4
- fix location of css/scss files for roboto

* Tue Sep 08 2015 Chandan Kumar <chkumar246@gmail.com> - 0.4.3.2-3
- Fixed shebang rpmlint issue in .svg files
- use roboto-fontface-fonts due to bug in google-roboto-fonts

* Tue Sep 08 2015 Chandan Kumar <chkumar246@gmail.com> - 0.4.3.2-2
- use google-roboto-fonts and google-roboto-commons

* Sat Sep 05 2015 chandankumar <chkumar246@gmail.com> - 0.4.3.2-1
- Initial package.