]>
Commit | Line | Data |
---|---|---|
5c9c0f33 ER |
1 | # |
2 | # Conditional build: | |
4c8a2e1b JB |
3 | %bcond_without doc # Sphinx documentation |
4 | %bcond_without tests # unit tests | |
6c5ec07f JB |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
5c9c0f33 ER |
7 | |
8 | %define module iso8601 | |
9 | Summary: Simple module to parse ISO 8601 dates | |
6c5ec07f | 10 | Summary(pl.UTF-8): Prosty moduł do analizy dat ISO 8601 |
5c9c0f33 | 11 | Name: python-%{module} |
4c8a2e1b JB |
12 | # keep 0.x here for python2 support |
13 | Version: 0.1.16 | |
14 | Release: 1 | |
5c9c0f33 | 15 | License: MIT |
6c5ec07f | 16 | Group: Development/Languages/Python |
a3e46659 | 17 | #Source0Download: https://pypi.org/simple/iso8601/ |
09f7179f | 18 | Source0: https://files.pythonhosted.org/packages/source/i/iso8601/%{module}-%{version}.tar.gz |
4c8a2e1b | 19 | # Source0-md5: ffe057a29bbc9defec7fdcf75ce6e25f |
9db94d01 | 20 | URL: https://bitbucket.org/micktwomey/pyiso8601 |
6c5ec07f JB |
21 | BuildRequires: rpm-pythonprov |
22 | BuildRequires: rpmbuild(macros) >= 1.714 | |
23 | %if %{with python2} | |
24 | BuildRequires: python-devel >= 1:2.6 | |
4c8a2e1b | 25 | %{?with_tests:BuildRequires: python-pytest >= 2.4.2} |
09f7179f | 26 | BuildRequires: python-setuptools |
6c5ec07f JB |
27 | %endif |
28 | %if %{with python3} | |
29 | BuildRequires: python3-devel >= 1:3.2 | |
4c8a2e1b | 30 | %{?with_tests:BuildRequires: python3-pytest >= 2.4.2} |
09f7179f | 31 | BuildRequires: python3-setuptools |
6c5ec07f | 32 | %endif |
4c8a2e1b JB |
33 | %if %{with doc} |
34 | BuildRequires: sphinx-pdg-2 >= 1.2.1 | |
35 | %endif | |
6c5ec07f | 36 | Requires: python-modules >= 1:2.6 |
5c9c0f33 ER |
37 | BuildArch: noarch |
38 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
39 | ||
40 | %description | |
41 | This module parses the most common forms of ISO 8601 date strings | |
42 | (e.g. 2007-01-14T20:34:22+00:00) into datetime objects. | |
43 | ||
6c5ec07f JB |
44 | %description -l pl.UTF-8 |
45 | Ten moduł analizuje najbardziej popularne postaci łańcuchów dat ISO | |
46 | 8601 (np. 2007-01-14T20:34:22+00:00) i przekształca na obiekty | |
47 | datetime. | |
48 | ||
49 | %package -n python3-%{module} | |
50 | Summary: Simple module to parse ISO 8601 dates | |
51 | Summary(pl.UTF-8): Prosty moduł do analizy dat ISO 8601 | |
52 | Group: Development/Languages/Python | |
53 | Requires: python3-modules >= 1:3.2 | |
54 | ||
55 | %description -n python3-%{module} | |
56 | This module parses the most common forms of ISO 8601 date strings | |
57 | (e.g. 2007-01-14T20:34:22+00:00) into datetime objects. | |
58 | ||
59 | %description -n python3-%{module} -l pl.UTF-8 | |
60 | Ten moduł analizuje najbardziej popularne postaci łańcuchów dat ISO | |
61 | 8601 (np. 2007-01-14T20:34:22+00:00) i przekształca na obiekty | |
62 | datetime. | |
63 | ||
4c8a2e1b JB |
64 | %package apidocs |
65 | Summary: API documentation for Python iso8601 module | |
66 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona iso8601 | |
67 | Group: Documentation | |
68 | ||
69 | %description apidocs | |
70 | API documentation for Python iso8601 module. | |
71 | ||
72 | %description apidocs -l pl.UTF-8 | |
73 | Dokumentacja API modułu Pythona iso8601. | |
74 | ||
5c9c0f33 ER |
75 | %prep |
76 | %setup -qn %{module}-%{version} | |
77 | ||
78 | %build | |
6c5ec07f | 79 | %if %{with python2} |
09f7179f JB |
80 | %py_build |
81 | ||
82 | %if %{with tests} | |
4c8a2e1b | 83 | %{__python} -m pytest iso8601/test_iso8601.py |
09f7179f | 84 | %endif |
6c5ec07f JB |
85 | %endif |
86 | ||
87 | %if %{with python3} | |
09f7179f JB |
88 | %py3_build |
89 | ||
90 | %if %{with tests} | |
4c8a2e1b | 91 | %{__python3} -m pytest iso8601/test_iso8601.py |
09f7179f | 92 | %endif |
6c5ec07f | 93 | %endif |
5c9c0f33 | 94 | |
4c8a2e1b JB |
95 | %if %{with doc} |
96 | %{__make} -C docs html \ | |
97 | SPHINXBUILD=sphinx-build-2 | |
98 | %endif | |
99 | ||
5c9c0f33 ER |
100 | %install |
101 | rm -rf $RPM_BUILD_ROOT | |
6c5ec07f JB |
102 | |
103 | %if %{with python2} | |
80ae9675 | 104 | %py_install |
5c9c0f33 ER |
105 | |
106 | %py_postclean | |
5c9c0f33 | 107 | %{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/iso8601/test_* |
6c5ec07f JB |
108 | %endif |
109 | ||
110 | %if %{with python3} | |
111 | %py3_install | |
112 | ||
113 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/iso8601/test_* | |
114 | %endif | |
5c9c0f33 ER |
115 | |
116 | %clean | |
117 | rm -rf $RPM_BUILD_ROOT | |
118 | ||
6c5ec07f | 119 | %if %{with python2} |
5c9c0f33 ER |
120 | %files |
121 | %defattr(644,root,root,755) | |
6c5ec07f | 122 | %doc LICENSE README.rst |
5c9c0f33 ER |
123 | %{py_sitescriptdir}/iso8601 |
124 | %{py_sitescriptdir}/iso8601-%{version}-py*.egg-info | |
6c5ec07f JB |
125 | %endif |
126 | ||
127 | %if %{with python3} | |
128 | %files -n python3-%{module} | |
129 | %defattr(644,root,root,755) | |
130 | %doc LICENSE README.rst | |
131 | %{py3_sitescriptdir}/iso8601 | |
132 | %{py3_sitescriptdir}/iso8601-%{version}-py*.egg-info | |
133 | %endif | |
4c8a2e1b JB |
134 | |
135 | %if %{with doc} | |
136 | %files apidocs | |
137 | %defattr(644,root,root,755) | |
138 | %doc docs/_build/html/{_modules,_static,*.html,*.js} | |
139 | %endif |