Blob Blame History Raw
%global with_python3 1
%global module_name freetype

Name:          python-%{module_name}
Version:       1.0.1
Release:       1%{?dist}
Summary:       Freetype python bindings

License:       BSD
URL:           https://github.com/rougier/freetype-py
Source0:       https://github.com/rougier/freetype-py/archive/v%{version}.tar.gz

BuildArch:     noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools

%description
Freetype python bindings.

%if 0%{with_python3}
%package -n python3-%{module_name}
Summary:        Freetype python bindings
License:        MIT
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif

%if 0%{with_python3}
%description -n python3-%{module_name}
Freetype python bindings.
%endif

%prep
%setup -q -n %{module_name}-py-%{version}
rm -rf *.egg-info

sed -i -e '/^#!\//, 1d' freetype/*.py
sed -i -e '/^#!\//, 1d' freetype/ft_enums/*.py

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'

%build
%{__python2} setup.py build

%if 0%{with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%install
%{__python2} setup.py install --skip-build --root=%{buildroot}

%if 0%{with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root=%{buildroot}
popd
%endif

%files -n python-%{module_name}
%doc examples LICENSE.txt
%{python2_sitelib}/%{module_name}/
%{python2_sitelib}/%{module_name}_py-%{version}-py2.?.egg-info

%if 0%{?with_python3}
%files -n python3-%{module_name}
%doc examples LICENSE.txt
%{python3_sitelib}/%{module_name}/
%{python3_sitelib}/%{module_name}_py-%{version}-py3.*.egg-info
%endif


%changelog
* Thu Feb 12 2015 Parag Nemade <pnemade AT redhat DOT com> - 1.0.1-1
- update to 1.0.1

* Wed Nov 05 2014 Parag Nemade <pnemade AT redhat DOT com> - 0.5.1-1
- update to 0.5.1
- Don't use Pypi as source URL as it contains wrong 1.0 tarball
- remove the removal of line 15 from setup.py as no data_files now

* Sun Nov 02 2014 Parag Nemade <pnemade AT redhat DOT com> - 0.4.2-3
- enable python3 subpackage

* Fri Oct 24 2014 Parag Nemade <pnemade AT redhat DOT com> - 0.4.2-2
- License is BSD not MIT

* Mon Sep 22 2014 Parag Nemade <pnemade AT redhat DOT com> - 0.4.2-1
- Initial packaging