]>
Commit | Line | Data |
---|---|---|
07670553 JB |
1 | # TODO: system uchardet? |
2 | # | |
3 | # Conditional build: | |
4 | %bcond_without tests # do not perform "make test" | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | Summary: cChardet - high speed universal character encoding detector | |
9 | Summary(pl.UTF-8): cChardet - szybki, uniwersalny wykrywacz kodowania znaków | |
10 | Name: python-cchardet | |
11 | Version: 2.1.5 | |
54ea5ee4 | 12 | Release: 6 |
07670553 JB |
13 | License: MPL v1.1 |
14 | Group: Libraries/Python | |
15 | #Source0Download: https://pypi.org/simple/cchardet/ | |
16 | Source0: https://files.pythonhosted.org/packages/source/c/cchardet/cchardet-%{version}.tar.gz | |
17 | # Source0-md5: 681af4e6546e47e2ae856057a8a7d105 | |
18 | URL: https://pypi.org/project/cchardet/ | |
19 | BuildRequires: libstdc++-devel | |
20 | %if %{with python2} | |
21 | BuildRequires: python-Cython | |
22 | BuildRequires: python-devel >= 1:2.7 | |
23 | BuildRequires: python-setuptools | |
24 | %if %{with tests} | |
25 | BuildRequires: python-nose | |
26 | %endif | |
27 | %endif | |
28 | %if %{with python3} | |
29 | BuildRequires: python3-Cython | |
30 | BuildRequires: python3-devel >= 1:3.5 | |
31 | BuildRequires: python3-setuptools | |
32 | %if %{with tests} | |
33 | BuildRequires: python3-nose | |
34 | %endif | |
35 | %endif | |
36 | BuildRequires: rpm-pythonprov | |
37 | BuildRequires: rpmbuild(macros) >= 1.714 | |
38 | Requires: python-modules >= 1:2.7 | |
39 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
40 | ||
41 | %description | |
42 | cChardet is high speed universal character encoding detector - binding | |
43 | to uchardet. | |
44 | ||
45 | %description -l pl.UTF-8 | |
46 | cChardet to szybki, uniwersalny wykrywacz kodowania znaków - wiązanie | |
47 | do biblioteki uchardet. | |
48 | ||
49 | %package -n python3-cchardet | |
50 | Summary: cChardet - high speed universal character encoding detector | |
51 | Summary(pl.UTF-8): cChardet - szybki, uniwersalny wykrywacz kodowania znaków | |
52 | Group: Libraries/Python | |
53 | Requires: python3-modules >= 1:3.5 | |
54 | ||
55 | %description -n python3-cchardet | |
56 | cChardet is high speed universal character encoding detector - binding | |
57 | to uchardet. | |
58 | ||
59 | %description -n python3-cchardet -l pl.UTF-8 | |
60 | cChardet to szybki, uniwersalny wykrywacz kodowania znaków - wiązanie | |
61 | do biblioteki uchardet. | |
62 | ||
63 | %prep | |
64 | %setup -q -n cchardet-%{version} | |
65 | ||
66 | ln -snf ../tests src/tests/tests | |
67 | ||
68 | # these fail: | |
69 | # - recognized as Windows-1252 | |
70 | %{__rm} src/tests/testdata/{fi,ga}/iso-8859-1.txt | |
71 | # - recognized as iso-8859-11 | |
72 | %{__rm} src/tests/testdata/th/tis-620.txt | |
73 | ||
74 | %build | |
75 | %if %{with python2} | |
76 | %py_build | |
77 | ||
78 | %if %{with tests} | |
79 | cd src/tests | |
80 | LC_ALL=C \ | |
81 | PYTHONPATH=$(readlink -f ../../build-2/lib.*) \ | |
82 | %{__python} -m nose test.py | |
83 | cd ../.. | |
84 | %endif | |
85 | %endif | |
86 | ||
87 | %if %{with python3} | |
88 | %py3_build | |
89 | ||
90 | %if %{with tests} | |
91 | cd src/tests | |
92 | LC_ALL=C \ | |
93 | PYTHONPATH=$(readlink -f ../../build-3/lib.*) \ | |
94 | %{__python3} -m nose test.py | |
95 | cd ../.. | |
96 | %endif | |
97 | %endif | |
98 | ||
99 | %install | |
100 | rm -rf $RPM_BUILD_ROOT | |
101 | ||
102 | %if %{with python2} | |
103 | %py_install | |
104 | ||
105 | %py_postclean | |
106 | %if %{with python3} | |
107 | %{__rm} $RPM_BUILD_ROOT%{_bindir}/cchardetect | |
108 | %endif | |
109 | %endif | |
110 | ||
111 | %if %{with python3} | |
112 | %py3_install | |
113 | %endif | |
114 | ||
115 | %clean | |
116 | rm -rf $RPM_BUILD_ROOT | |
117 | ||
118 | %if %{with python2} | |
119 | %files | |
120 | %defattr(644,root,root,755) | |
121 | %doc CHANGES.rst README.rst | |
122 | %if %{without python3} | |
123 | %attr(755,root,root) %{_bindir}/cchardetect | |
124 | %endif | |
125 | %dir %{py_sitedir}/cchardet | |
126 | %{py_sitedir}/cchardet/*.py[co] | |
127 | %attr(755,root,root) %{py_sitedir}/cchardet/*.so | |
128 | %{py_sitedir}/cchardet-%{version}-py*.egg-info | |
129 | %endif | |
130 | ||
131 | %if %{with python3} | |
132 | %files -n python3-cchardet | |
133 | %defattr(644,root,root,755) | |
134 | %doc CHANGES.rst README.rst | |
135 | %attr(755,root,root) %{_bindir}/cchardetect | |
136 | %dir %{py3_sitedir}/cchardet | |
137 | %{py3_sitedir}/cchardet/*.py | |
138 | %attr(755,root,root) %{py3_sitedir}/cchardet/*.so | |
139 | %{py3_sitedir}/cchardet/__pycache__ | |
140 | %{py3_sitedir}/cchardet-%{version}-py*.egg-info | |
141 | %endif |