Blob Blame History Raw
%global pkgname babelfish

Name:           python-%{pkgname}
Version:        0.5.5
Release:        3%{?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:  python-sphinx
#BuildRequires:  python-sphinx_rtd_theme

%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
#!/usr/bin/env python
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/env 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
* 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