]>
Commit | Line | Data |
---|---|---|
06927072 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
6dd1601c JB |
5 | %bcond_without doc # Sphinx documentation |
6 | %bcond_without tests # unit tets | |
764b2389 | 7 | |
06927072 JB |
8 | %define module chardet |
9 | Summary: Character encoding auto-detection in Python 2 | |
10 | Summary(pl.UTF-8): Automatyczne wykrywanie kodowania znaków w Pythonie 2 | |
764b2389 | 11 | Name: python-%{module} |
2ea6bcb1 | 12 | Version: 4.0.0 |
3de6090b | 13 | Release: 3 |
06927072 | 14 | License: LGPL v2.1+ |
035e1894 | 15 | Group: Libraries/Python |
6dd1601c JB |
16 | #Source0Download: https://pypi.org/simple/chardet/ |
17 | Source0: https://files.pythonhosted.org/packages/source/c/chardet/%{module}-%{version}.tar.gz | |
2ea6bcb1 | 18 | # Source0-md5: bc9a5603d8d0994b2d4cbf255f99e654 |
6dd1601c | 19 | URL: https://pypi.org/project/chardet/ |
06927072 | 20 | %if %{with python2} |
7dbc438f JB |
21 | BuildRequires: python >= 1:2.7 |
22 | BuildRequires: python-devel >= 1:2.7 | |
06927072 | 23 | BuildRequires: python-setuptools |
6dd1601c JB |
24 | %if %{with tests} |
25 | BuildRequires: python-hypothesis | |
26 | BuildRequires: python-pytest | |
27 | %endif | |
06927072 JB |
28 | %endif |
29 | %if %{with python3} | |
7dbc438f JB |
30 | BuildRequires: python3 >= 1:3.5 |
31 | BuildRequires: python3-devel >= 1:3.5 | |
06927072 | 32 | BuildRequires: python3-setuptools |
6dd1601c JB |
33 | %if %{with tests} |
34 | BuildRequires: python3-hypothesis | |
35 | BuildRequires: python3-pytest | |
36 | %endif | |
37 | %endif | |
38 | %if %{with doc} | |
12478bb9 JB |
39 | BuildRequires: python3-sphinx_rtd_theme |
40 | BuildRequires: sphinx-pdg-3 | |
06927072 | 41 | %endif |
25c19e4a | 42 | BuildRequires: rpm-pythonprov |
06927072 | 43 | BuildRequires: rpmbuild(macros) >= 1.714 |
7dbc438f | 44 | Requires: python-modules >= 1:2.7 |
da08e7be | 45 | BuildArch: noarch |
764b2389 JR |
46 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
47 | ||
48 | %description | |
3d61b479 | 49 | Character encoding auto-detection in Python. As smart as your browser. |
764b2389 JR |
50 | |
51 | %description -l pl.UTF-8 | |
3d61b479 | 52 | Automatyczne wykrywanie kodowania znaków w Pythonie. Tak zmyślne jak w |
53 | przeglądarce. | |
764b2389 | 54 | |
06927072 JB |
55 | %package -n python3-chardet |
56 | Summary: Character encoding auto-detection in Python 3 | |
57 | Summary(pl.UTF-8): Automatyczne wykrywanie kodowania znaków w Pythonie 3 | |
58 | Group: Libraries/Python | |
7dbc438f | 59 | Requires: python3-modules >= 1:3.5 |
06927072 JB |
60 | |
61 | %description -n python3-chardet | |
62 | Character encoding auto-detection in Python. As smart as your browser. | |
63 | ||
64 | %description -n python3-chardet -l pl.UTF-8 | |
65 | Automatyczne wykrywanie kodowania znaków w Pythonie. Tak zmyślne jak w | |
66 | przeglądarce. | |
67 | ||
6dd1601c JB |
68 | %package apidocs |
69 | Summary: API documentation for Python chardet module | |
70 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona chardet | |
71 | Group: Documentation | |
72 | ||
73 | %description apidocs | |
74 | API documentation for Python chardet module. | |
75 | ||
76 | %description apidocs -l pl.UTF-8 | |
77 | Dokumentacja API modułu Pythona chardet. | |
78 | ||
764b2389 JR |
79 | %prep |
80 | %setup -q -n %{module}-%{version} | |
81 | ||
82 | %build | |
06927072 | 83 | %if %{with python2} |
9206d4a4 JB |
84 | %py_build |
85 | ||
86 | %if %{with tests} | |
87 | %{__python} -m pytest test.py | |
88 | %endif | |
06927072 JB |
89 | %endif |
90 | ||
91 | %if %{with python3} | |
9206d4a4 JB |
92 | %py3_build |
93 | ||
94 | %if %{with tests} | |
95 | %{__python3} -m pytest test.py | |
96 | %endif | |
6dd1601c JB |
97 | %endif |
98 | ||
99 | %if %{with doc} | |
100 | PYTHONPATH=$(pwd) \ | |
12478bb9 JB |
101 | %{__make} -C docs html \ |
102 | SPHINXBUILD=sphinx-build-3 | |
06927072 | 103 | %endif |
764b2389 JR |
104 | |
105 | %install | |
106 | rm -rf $RPM_BUILD_ROOT | |
107 | ||
06927072 JB |
108 | %if %{with python3} |
109 | %py3_install | |
110 | %endif | |
111 | ||
112 | %if %{with python2} | |
89b49f7c | 113 | %py_install |
764b2389 JR |
114 | |
115 | %py_postclean | |
06927072 | 116 | %endif |
764b2389 JR |
117 | |
118 | %clean | |
119 | rm -rf $RPM_BUILD_ROOT | |
120 | ||
06927072 | 121 | %if %{with python2} |
764b2389 JR |
122 | %files |
123 | %defattr(644,root,root,755) | |
06927072 | 124 | %doc README.rst |
e096522f | 125 | %attr(755,root,root) %{_bindir}/chardetect |
06927072 JB |
126 | %{py_sitescriptdir}/chardet |
127 | %{py_sitescriptdir}/chardet-%{version}-py*.egg-info | |
128 | %endif | |
129 | ||
130 | %if %{with python3} | |
131 | %files -n python3-chardet | |
132 | %defattr(644,root,root,755) | |
e096522f | 133 | %doc README.rst |
06927072 JB |
134 | %{py3_sitescriptdir}/chardet |
135 | %{py3_sitescriptdir}/chardet-%{version}-py*.egg-info | |
ddd2957e | 136 | %endif |
6dd1601c JB |
137 | |
138 | %if %{with doc} | |
139 | %files apidocs | |
140 | %defattr(644,root,root,755) | |
141 | %doc docs/_build/html/{_modules,_static,api,*.html,*.js} | |
142 | %endif |