diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..fcc7b97
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+
+ test
+
diff --git a/python-chardet.changes b/python-chardet.changes
index 9f946ca..e243c2a 100644
--- a/python-chardet.changes
+++ b/python-chardet.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Tue Feb 26 08:14:25 UTC 2019 - Tomáš Chvátal
+
+- Switch to multibuild to avoid buildcycles
+
-------------------------------------------------------------------
Tue Dec 4 12:49:12 UTC 2018 - Matej Cepl
diff --git a/python-chardet.spec b/python-chardet.spec
index c908647..ff36eb7 100644
--- a/python-chardet.spec
+++ b/python-chardet.spec
@@ -1,7 +1,7 @@
#
# spec file for package python-chardet
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,15 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-Name: python-chardet
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+Name: python-chardet%{psuffix}
Version: 3.0.4
Release: 0
Summary: Universal encoding detector
@@ -26,14 +34,16 @@ Group: Development/Languages/Python
URL: https://github.com/chardet/chardet
Source0: https://files.pythonhosted.org/packages/source/c/chardet/chardet-%{version}.tar.gz
Source1: python-chardet-rpmlintrc
-BuildRequires: %{python_module hypothesis}
-BuildRequires: %{python_module pytest-runner}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
+%if %{with test}
+BuildRequires: %{python_module hypothesis}
+BuildRequires: %{python_module pytest-runner}
+%endif
%python_subpackages
%description
@@ -72,17 +82,20 @@ or more files::
%python_build
%install
-%python_install
+%if !%{with test}
%{python_expand %$python_install
mv %{buildroot}%{_bindir}/chardetect %{buildroot}%{_bindir}/chardetect-%{$python_bin_suffix}
%fdupes -s %{buildroot}%{$python_sitelib}
}
-
%prepare_alternative chardetect
+%endif
%check
+%if %{with test}
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_version} test.py
+%endif
+%if !%{with test}
%post
%python_install_alternative chardetect
@@ -94,5 +107,6 @@ mv %{buildroot}%{_bindir}/chardetect %{buildroot}%{_bindir}/chardetect-%{$python
%python_alternative %{_bindir}/chardetect
%{python_sitelib}/chardet
%{python_sitelib}/chardet-%{version}-py%{python_version}.egg-info
+%endif
%changelog