Blob Blame History Raw
%global with_python3 1
%global srcname tzlocal

Name:           python-tzlocal
Version:        1.1.2
Release:        2%{?dist}
Summary:        A Python module that tries to figure out what your local timezone is

License:        CC0
URL:            https://github.com/regebro/tzlocal
Source0:        https://pypi.python.org/packages/source/t/%{srcname}/%{srcname}-%{version}.zip

BuildArch:      noarch

Requires:       pytz
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  pytz
%if 0%{?with_python3}
Requires:       python3-pytz
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.


%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary:        A Python module that tries to figure out what your local timezone is

License:        CC0

%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
%setup -q -n %{srcname}-%{version}

rm -rf *.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif


%build
%{__python2} setup.py build

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


%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}

# 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*
popd
%endif

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

# Don't install unit tests and test_data
rm -rf %{buildroot}%{python2_sitelib}/%{srcname}/test_data
rm %{buildroot}%{python2_sitelib}/%{srcname}/tests.py*


%check
%{__python2} setup.py test

%if 0%{?with_python3}
%{__python3} setup.py test
%endif


%files
%doc PKG-INFO README.rst LICENSE.txt CHANGES.txt
%{python2_sitelib}/%{srcname}
%{python2_sitelib}/%{srcname}-%{version}-py2.?.egg-info

%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc PKG-INFO README.rst LICENSE.txt CHANGES.txt
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py3.?.egg-info
%endif


%changelog
* 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