Blob Blame History Raw
# Created by pyp2rpm-1.1.2
%if 0%{?fedora}
%global with_python3 1
%endif

%global pypi_name XStatic-bootswatch

Name:           python-%{pypi_name}
Version:        3.3.7.0
Release:        1%{?dist}
Summary:        bootswatch (XStatic packaging standard)

License:        MIT
URL:            http://bootswatch.com
Source0:        https://pypi.io/packages/source/X/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
Source1:        https://raw.githubusercontent.com/openstack/xstatic-bootswatch/master/LICENSE
BuildArch:      noarch

%description
Bootswatch javascript library packaged
for setuptools (easy_install) / pip.

Free themes for Bootstrap

%package -n python2-%{pypi_name}
Summary:        bootswatch (XStatic packaging standard)
%{?python_provide:%python_provide python2-%{pypi_name}}
# python_provide does not exist in CentOS7 buildroot
Provides:       python-%{pypi_name} = %{version}-%{release}

BuildRequires:  python2-devel
BuildRequires:  python-setuptools

Requires:       python-XStatic
Requires:       bootswatch-common = %{version}-%{release}
Requires:       bootswatch-fonts  = %{version}-%{release}

%description -n python2-%{pypi_name}
bootswatch javascript library packaged
for setuptools (easy_install) / pip.

Free themes for Bootstrap

%package -n bootswatch-common
Summary:    bootswatch (XStatic packaging standard) common files
BuildRequires:  web-assets-devel

Requires:       web-assets-filesystem

%description -n bootswatch-common
Common bootswatch static content (CSS and SCSS)

%package -n bootswatch-fonts
Summary:    bootswatch (XStatic packaging standard) fonts
BuildRequires:  fontpackages-filesystem

Requires:       fontpackages-filesystem

%description -n bootswatch-fonts
Bootswatch fonts

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

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools

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

%description -n python3-%{pypi_name}
bootswatch javascript library packaged
for setuptools (easy_install) / pip.

Free themes for Bootstrap
%endif


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

# patch to use webassets dir
sed -i "s|^BASE_DIR = .*|BASE_DIR = '%{_jsdir}/bootswatch'|" xstatic/pkg/bootswatch/__init__.py
# License file is present in GitHub repo, but not in PyPi file
cp %{SOURCE1} .


%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/bootswatch
mv %{buildroot}/%{python2_sitelib}/xstatic/pkg/bootswatch/data/fonts/* %{buildroot}/%{_datadir}/fonts/bootswatch
rmdir %{buildroot}/%{python2_sitelib}/xstatic/pkg/bootswatch/data/fonts

# Move static files
mkdir -p %{buildroot}/%{_jsdir}/bootswatch
for theme in cerulean cosmo cyborg darkly flatly journal lumen paper readable sandstone simplex slate spacelab superhero united yeti
do
 mv %{buildroot}/%{python2_sitelib}/xstatic/pkg/bootswatch/data/${theme} %{buildroot}/%{_jsdir}/bootswatch
done

%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/bootswatch/data/fonts
for theme in cerulean cosmo cyborg darkly flatly journal lumen paper readable sandstone simplex slate spacelab superhero united yeti
do
 rm -rf %{buildroot}/%{python3_sitelib}/xstatic/pkg/bootswatch/data/${theme}
done

%endif

%files -n python2-%{pypi_name}
%doc README.txt
%license LICENSE
%{python2_sitelib}/xstatic/pkg/bootswatch
%{python2_sitelib}/XStatic_bootswatch-%{version}-py?.?.egg-info
%{python2_sitelib}/XStatic_bootswatch-%{version}-py?.?-nspkg.pth

%files -n bootswatch-common
%doc README.txt
%license LICENSE
%{_jsdir}/bootswatch

%files -n bootswatch-fonts
%doc README.txt
%license LICENSE
%{_datadir}/fonts/bootswatch

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

%changelog
* Mon Feb  6 2017 Haïkel Guémar <hguemar@fedoraproject.org> - 3.3.7.0-1
- Upstream 3.3.7.0

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

* Fri Aug 19 2016 jpena <jpena@redhat.com> - 3.3.6.0-1
- Updated to upstream version 3.3.6.0
- Added external license file, it is no longer bundled in source
- Fixed source URL

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

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

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

* Mon Sep 07 2015 jpena <jpena@redhat.com> - 3.3.5.3-2
- Added bootswatch-fonts subpackage.
- Shortened description.
* Fri Sep 04 2015 jpena <jpena@redhat.com> - 3.3.5.3-1
- Initial package.