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