Blob Blame History Raw
%global pkgname babelfish

Name:           python-%{pkgname}
Version:        0.5.5
Release:        7%{?dist}
Summary:        Python library to work with countries and languages

License:        BSD
URL:            https://babelfish.readthedocs.org/
Source:         https://github.com/Diaoul/%{pkgname}/archive/%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-devel 
BuildRequires:  python3-devel
BuildRequires:  python2-sphinx
BuildRequires:  python3-sphinx

%description
Babelfish makes it easy to work with countries, languages, scripts, ISO codes
and IETF codes from Python. It has converters between all different data
can be extended to use custom converters and data.

%package -n python2-%{pkgname}
Summary:        Python library to work with countries and languages
%{?python_provide:%python_provide python2-%{pkgname}}
Suggests:       %{name}-doc = %{version}-%{release}

%description -n python2-%{pkgname}
Babelfish makes it easy to work with countries, languages, scripts, ISO codes
and IETF codes from Python. It has converters between all different data
can be extended to use custom converters and data.

%package -n python3-%{pkgname}
Summary:        Python library to work with countries and languages
%{?python_provide:%python_provide python3-%{pkgname}}
Suggests:       %{name}-doc = %{version}-%{release}

%description -n python3-%{pkgname}
Babelfish makes it easy to work with countries, languages, scripts, ISO codes
and IETF codes from Python. It has converters between all different data
can be extended to use custom converters and data.

%package doc
Summary:        Documentation for %{pkgname} python library

%description doc
Documentation for %{pkgname} python library

%prep
%autosetup -n %{pkgname}-%{version}

%build
%py2_build
%py3_build
pushd docs
%make_build text
%make_build man
find . -type f -name '.buildinfo' -delete
popd

%install
%py2_install
%py3_install
install -D -m 0644 docs/_build/man/%{pkgname}.1 %{buildroot}%{_mandir}/man1/%{pkgname}.1
chmod 755 %{buildroot}%{python2_sitelib}/%{pkgname}/tests.py
chmod 755 %{buildroot}%{python3_sitelib}/%{pkgname}/tests.py
sed -i -e 's,^#!/usr/bin/env python$,#!/usr/bin/python2,g' %{buildroot}%{python2_sitelib}/%{pkgname}/tests.py
sed -i -e 's,^#!/usr/bin/env python$,#!/usr/bin/python3,g' %{buildroot}%{python3_sitelib}/%{pkgname}/tests.py

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

%files -n python2-%{pkgname}
%license LICENSE
%{python2_sitelib}/%{pkgname}
%{python2_sitelib}/%{pkgname}-%{version}-py*.egg-info

%files -n python3-%{pkgname}
%license LICENSE
%{python3_sitelib}/%{pkgname}
%{python3_sitelib}/%{pkgname}-%{version}-py*.egg-info

%files doc
%doc AUTHORS README.rst HISTORY.rst docs/_build/text
%license LICENSE
%{_mandir}/man1/%{pkgname}.1*

%changelog
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Jul 01 2017 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.5.5-6
- Python3 changes

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

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 0.5.5-4
- Rebuild for Python 3.6

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

* Fri Mar 11 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.5.5-2
- LICENSE in doc subpackage
- Make test.py executable

* Wed Jan 13 2016 Juan Orti Alcaine <jorti@fedoraproject.org> - 0.5.5-1
- Initial package