# enable python3 on fedora
%if 0%{?fedora}
%bcond_without python3
%else
%bcond_with python3
%endif
%global srcname tzlocal
%global sum A Python module that tries to figure out what your local timezone is
Name: python-tzlocal
Version: 1.3
Release: 3%{?dist}
Summary: %{sum}
License: CC0
URL: https://github.com/regebro/tzlocal
Source0: https://files.pythonhosted.org/packages/source/t/%{srcname}/%{srcname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python2-pytz
BuildRequires: python2-setuptools
%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3-pytz
BuildRequires: python3-setuptools
%endif
%description
This Python module returns a tzinfo object with the local timezone information.
It requires pytz, and returns pytz tzinfo objects. This module attempts to fix
a glaring hole in pytz, that there is no way to get the local timezone
information, unless you know the zoneinfo name.
%package -n python2-%{srcname}
Summary: %{sum}
License: CC0
Requires: python2-pytz
%{?python_provide:%python_provide python2-%{srcname}}
%description -n python2-%{srcname}
This Python module returns a tzinfo object with the local timezone information.
It requires pytz, and returns pytz tzinfo objects. This module attempts to fix
a glaring hole in pytz, that there is no way to get the local timezone
information, unless you know the zoneinfo name.
%if %{with python3}
%package -n python3-%{srcname}
Summary: %{sum}
License: CC0
Requires: python3-pytz
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname}
This Python module returns a tzinfo object with the local timezone information.
It requires pytz, and returns pytz tzinfo objects. This module attempts to fix
a glaring hole in pytz, that there is no way to get the local timezone
information, unless you know the zoneinfo name.
%endif
%prep
%autosetup -n %{srcname}-%{version}
rm -rf *.egg-info
%build
%py2_build
%if %{with python3}
%py3_build
%endif
%install
%py2_install
# Don't install unit tests and test_data
rm -rf %{buildroot}%{python2_sitelib}/%{srcname}/test_data
rm %{buildroot}%{python2_sitelib}/%{srcname}/tests.py*
%if %{with python3}
%py3_install
# Don't install unit tests and test_data
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/test_data
rm %{buildroot}%{python3_sitelib}/%{srcname}/tests.py
rm %{buildroot}%{python3_sitelib}/%{srcname}/__pycache__/tests.cpython*
%endif
%check
%{__python2} setup.py test
%if %{with python3}
%{__python3} setup.py test
%endif
%files -n python2-%{srcname}
%doc PKG-INFO README.rst CHANGES.txt
%license LICENSE.txt
%{python2_sitelib}/%{srcname}
%{python2_sitelib}/%{srcname}-%{version}-py2.?.egg-info
%if %{with python3}
%files -n python3-%{srcname}
%doc PKG-INFO README.rst CHANGES.txt
%license LICENSE.txt
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py3.?.egg-info
%endif
%changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.3-2
- Rebuild for Python 3.6
* Wed Nov 09 2016 piotr1212@gmail.com - 1.3-1
- Update to upstream 1.3
- Update specfile to latest python packaging guidelines
* Wed Nov 09 2016 piotr1212@gmail.com - 1.2-6
- Move python3-pytz requires to python3 subpackage (RHBZ#1393397)
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Fri Nov 06 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.2-2
- Rebuilt for python 3.5
* Fri Jul 03 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.2-1
- Update to 1.2
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Nov 22 2014 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-4
- added epel support
* Tue Oct 28 2014 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-3
- fixed python3-tzlocal %%summary to match python-tzlocal
* Sat Oct 25 2014 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-2
- deleted group tag
- added license to python3 module
- rewritten summary
- wrapped description
- added rm -rf *.egg-info to %%prep
- added comments to the rm commands in %%install section
* Fri Oct 24 2014 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-1
- Initial package