3479a9c
# needed for epel6
3479a9c
%if 0%{?rhel} && 0%{?rhel} <= 6
3479a9c
%{!?__python2: %global __python2 /usr/bin/python2}
3479a9c
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
3479a9c
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
3479a9c
%endif
3479a9c
3479a9c
# enable python3 on fedora
3479a9c
%if 0%{?fedora}
3479a9c
%bcond_without python3
3479a9c
%else
3479a9c
%bcond_with python3
3479a9c
%endif
3479a9c
51098ba
%global srcname tzlocal
51098ba
51098ba
Name:           python-tzlocal
b62c1ce
Version:        1.2
b62c1ce
Release:        1%{?dist}
51098ba
Summary:        A Python module that tries to figure out what your local timezone is
51098ba
51098ba
License:        CC0
51098ba
URL:            https://github.com/regebro/tzlocal
b62c1ce
Source0:        https://pypi.python.org/packages/source/t/%{srcname}/%{srcname}-%{version}.tar.gz
51098ba
51098ba
BuildArch:      noarch
51098ba
51098ba
Requires:       pytz
51098ba
BuildRequires:  python-devel
51098ba
BuildRequires:  python-setuptools
51098ba
BuildRequires:  pytz
3479a9c
%if %{with python3}
51098ba
Requires:       python3-pytz
51098ba
BuildRequires:  python3-devel
51098ba
BuildRequires:  python3-pytz
51098ba
BuildRequires:  python3-setuptools
51098ba
%endif
51098ba
51098ba
51098ba
%description
51098ba
This Python module returns a tzinfo object with the local timezone information. 
51098ba
It requires pytz, and returns pytz tzinfo objects.  This module attempts to fix 
51098ba
a glaring hole in pytz, that there is no way to get the local timezone 
51098ba
information, unless you know the zoneinfo name.
51098ba
51098ba
3479a9c
%if %{with python3}
51098ba
%package -n python3-%{srcname}
51098ba
Summary:        A Python module that tries to figure out what your local timezone is
51098ba
51098ba
License:        CC0
51098ba
51098ba
%description -n python3-%{srcname}
51098ba
This Python module returns a tzinfo object with the local timezone information. 
51098ba
It requires pytz, and returns pytz tzinfo objects.  This module attempts to fix 
51098ba
a glaring hole in pytz, that there is no way to get the local timezone 
51098ba
information, unless you know the zoneinfo name.
51098ba
51098ba
%endif
51098ba
51098ba
51098ba
%prep
51098ba
%setup -q -n %{srcname}-%{version}
51098ba
51098ba
rm -rf *.egg-info
51098ba
3479a9c
%if %{with python3}
51098ba
rm -rf %{py3dir}
51098ba
cp -a . %{py3dir}
51098ba
%endif
51098ba
51098ba
51098ba
%build
51098ba
%{__python2} setup.py build
51098ba
3479a9c
%if %{with python3}
51098ba
pushd %{py3dir}
51098ba
%{__python3} setup.py build
51098ba
popd
51098ba
%endif
51098ba
51098ba
51098ba
%install
3479a9c
%if %{with python3}
51098ba
pushd %{py3dir}
51098ba
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
51098ba
51098ba
# Don't install unit tests and test_data
51098ba
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/test_data
51098ba
rm %{buildroot}%{python3_sitelib}/%{srcname}/tests.py
51098ba
rm %{buildroot}%{python3_sitelib}/%{srcname}/__pycache__/tests.cpython*
51098ba
popd
51098ba
%endif
51098ba
51098ba
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
51098ba
51098ba
# Don't install unit tests and test_data
51098ba
rm -rf %{buildroot}%{python2_sitelib}/%{srcname}/test_data
51098ba
rm %{buildroot}%{python2_sitelib}/%{srcname}/tests.py*
51098ba
51098ba
51098ba
%check
51098ba
%{__python2} setup.py test
51098ba
3479a9c
%if %{with python3}
51098ba
%{__python3} setup.py test
51098ba
%endif
51098ba
51098ba
51098ba
%files
b62c1ce
%doc PKG-INFO README.rst CHANGES.txt
b62c1ce
%license LICENSE.txt
51098ba
%{python2_sitelib}/%{srcname}
51098ba
%{python2_sitelib}/%{srcname}-%{version}-py2.?.egg-info
51098ba
3479a9c
%if %{with python3}
51098ba
%files -n python3-%{srcname}
b62c1ce
%doc PKG-INFO README.rst CHANGES.txt
b62c1ce
%license LICENSE.txt
51098ba
%{python3_sitelib}/%{srcname}
51098ba
%{python3_sitelib}/%{srcname}-%{version}-py3.?.egg-info
51098ba
%endif
51098ba
51098ba
51098ba
%changelog
b62c1ce
* Fri Jul 03 2015 Piotr Popieluch <piotr1212@gmail.com> - 1.2-1
b62c1ce
- Update to 1.2
b62c1ce
756a55c
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-5
756a55c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
756a55c
3479a9c
* Sat Nov 22 2014 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-4
3479a9c
- added epel support
3479a9c
011a5a6
* Tue Oct 28 2014 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-3
011a5a6
- fixed python3-tzlocal %%summary to match python-tzlocal
011a5a6
51098ba
* Sat Oct 25 2014 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-2
51098ba
- deleted group tag
51098ba
- added license to python3 module
51098ba
- rewritten summary
51098ba
- wrapped description
51098ba
- added rm -rf *.egg-info to %%prep
51098ba
- added comments to the rm commands in %%install section
51098ba
51098ba
* Fri Oct 24 2014 Piotr Popieluch <piotr1212@gmail.com> - 1.1.2-1
51098ba
- Initial package