File saltbundlepy-chardet.spec of Package saltbundlepy-chardet

#
# spec file for package saltbundlepy-chardet
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
%define pythons saltbundlepy

# Disable python bytecompile for all distros
# It's called explicitly in the spec
%global __brp_python_bytecompile %{nil}

%bcond_with     tests

Name:           saltbundlepy-chardet
Version:        3.0.4
Release:        0
Summary:        Universal encoding detector
License:        LGPL-2.1-or-later
Group:          Development/Languages/Python
URL:            https://github.com/chardet/chardet
Source0:        https://files.pythonhosted.org/packages/source/c/chardet/chardet-%{version}.tar.gz
Source1:        saltbundlepy-chardet-rpmlintrc
Patch0:         prevent_fake_link.patch
BuildRequires:  %{saltbundlepy_module devel >= 3.10}
BuildRequires:  %{saltbundlepy_module setuptools}
%if %{with tests}
BuildRequires:  %{saltbundlepy_module hypothesis}
BuildRequires:  %{saltbundlepy_module pytest-runner}
%endif
BuildRequires:  fdupes
BuildRequires:  saltbundlepy-rpm-macros
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires:       saltbundlepy-base
%python_subpackages

%description
Universal character encoding detector
-------------------------------------

Detects
 - ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants)
 - Big5, GB2312, EUC-TW, HZ-GB-2312, ISO-2022-CN (Traditional and Simplified Chinese)
 - EUC-JP, SHIFT_JIS, ISO-2022-JP (Japanese)
 - EUC-KR, ISO-2022-KR (Korean)
 - KOI8-R, MacCyrillic, IBM855, IBM866, ISO-8859-5, windows-1251 (Cyrillic)
 - ISO-8859-2, windows-1250 (Hungarian)
 - ISO-8859-5, windows-1251 (Bulgarian)
 - windows-1252 (English)
 - ISO-8859-7, windows-1253 (Greek)
 - ISO-8859-8, windows-1255 (Visual and Logical Hebrew)
 - TIS-620 (Thai)

Requires Python 2.1 or later

Command-line Tool
-----------------

chardet comes with a command-line script which reports on the encodings of one
or more files::

    % chardetect.py somefile someotherfile
    somefile: windows-1252 with confidence 0.5
    someotherfile: ascii with confidence 1.0

%prep
%setup -q -n chardet-%{version}
%autopatch -p1

%build
%python_build

%install
%python_install
%{python_expand %$python_install
mv %{buildroot}%{_bindir}/chardetect %{buildroot}%{_bindir}/chardetect-%{$python_bin_suffix}
%fdupes -s %{buildroot}%{$python_sitelib}
}

%prepare_alternative chardetect

%if %{with tests}
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_version} test.py
%endif

%post
%python_install_alternative chardetect

%postun
%python_install_alternative chardetect

%files %{python_files}
%defattr(-,root,root,-)
%doc README.rst
%python_alternative %{_bindir}/chardetect
%{python_sitelib}/chardet
%{python_sitelib}/chardet-%{version}-py%{python_version}.egg-info

%changelog
openSUSE Build Service is sponsored by