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

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

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

License:        ASL 2.0
URL:            https://github.com/choffmeister/roboto-fontface-bower
Source0:        https://pypi.python.org/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:  python-setuptools

Requires:    python-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/*.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


%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
* 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.