-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-pytz.spec
More file actions
133 lines (112 loc) · 3.59 KB
/
Copy pathpython-pytz.spec
File metadata and controls
133 lines (112 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
# Conditional build:
%bcond_without python2 # Python 2.x modules
%bcond_without python3 # Python 3.x modules
%bcond_without tests # unit tests
#
# NOTE:
# - as we use system tzdata package, keeping this pkg up to the latest is
# pointless if only data has changed
# - ...but other packages may require newer version anyway, through egg dependencies
%define module pytz
# pytz/__init__.py /OLSON_VERSION
%define olsonver 2026c
Summary: pytz - Olson timezone database in Python
Summary(pl.UTF-8): pytz - baza stref czasowych Olsona w Pythonie
Name: python-%{module}
Version: 2026.3.post1
Release: 1
License: MIT or ZPL v2.1
Group: Libraries/Python
#Source0Download: https://pypi.org/simple/pytz/
Source0: https://files.pythonhosted.org/packages/source/p/pytz/pytz-%{version}.tar.gz
# Source0-md5: 095e9edf5051aec8901beb072eb31a79
Patch0: zoneinfo.patch
URL: http://pytz.sourceforge.net/
BuildRequires: rpmbuild(macros) >= 1.714
BuildRequires: sed >= 4.0
%if %{with python2}
BuildRequires: python >= 1:2.5
BuildRequires: python-devel >= 1:2.5
BuildRequires: python-setuptools
%endif
%if %{with python3}
BuildRequires: python3-devel >= 1:3.2
BuildRequires: python3-setuptools
%endif
Requires: python-modules >= 1:2.5
Requires: tzdata-zoneinfo >= %{olsonver}
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
pytz brings the Olson tz database into Python. This library allows
accurate and cross platform timezone calculations using Python 2.5 or
higher.
%description -l pl.UTF-8
pytz dodaje do Pythona moduł umożliwiający odpytywanie bazy stref
czasowych Olsona. Moduł ten umożliwia przeprowadzanie dokładnych,
niezależnych od platformy obliczeń uwzględniających strefy czasowe
przy użyciu Pythona w wersji co najmniej 2.5.
%package -n python3-%{module}
Summary: pytz - Olson timezone database in Python 3.x
Summary(pl.UTF-8): pytz - baza stref czasowych Olsona w Pythonie 3.x
Group: Libraries/Python
Requires: python3-modules >= 1:3.2
Requires: tzdata-zoneinfo >= %{olsonver}
%description -n python3-%{module}
pytz brings the Olson tz database into Python. This library allows
accurate and cross platform timezone calculations using Python 3.x
%description -n python3-%{module} -l pl.UTF-8
pytz dodaje do Pythona moduł umożliwiający odpytywanie bazy stref
czasowych Olsona. Moduł ten umożliwia przeprowadzanie dokładnych,
niezależnych od platformy obliczeń uwzględniających strefy czasowe
przy użyciu Pythona 3.x
%prep
%setup -q -n %{module}-%{version}
# strip zones lists before patching
%{__sed} -i -e "/^_all_timezones_unchecked = \\\\\$/,/^ 'Zulu'\]/d" \
-e "/^common_timezones = \\\\\$/,/ 'UTC'/d" pytz/__init__.py
%patch -P 0 -p1
%build
v=$(sed -rne "s/^OLSON_VERSION = '(.+)'/\1/p" pytz/__init__.py)
test "$v" = "%{olsonver}"
%if %{with python2}
%py_build
%py_lint
%if %{with tests}
%{__python} -munittest discover -s pytz/tests
%endif
%endif
%if %{with python3}
%py3_build
%if %{with tests}
%{__python3} -munittest discover -s pytz/tests
%endif
%endif
%install
rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%py_install
%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/pytz/zoneinfo
%py_postclean
%endif
%if %{with python3}
%py3_install
%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/pytz/zoneinfo
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%files
%defattr(644,root,root,755)
%doc LICENSE.txt README.rst
%{py_sitescriptdir}/pytz
%{py_sitescriptdir}/pytz-%{version}-py*.egg-info
%endif
%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
%doc LICENSE.txt README.rst
%{py3_sitescriptdir}/pytz
%{py3_sitescriptdir}/pytz-%{version}-py*.egg-info
%endif