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-libcst.changes b/python-libcst.changes
index 9c1a3e1..e37b6b7 100644
--- a/python-libcst.changes
+++ b/python-libcst.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Fri Aug 21 09:43:55 UTC 2020 - Tomáš Chvátal
+
+- Switch to multibuild in order to avoid buildcycles
+
-------------------------------------------------------------------
Sat Aug 8 04:41:45 UTC 2020 - John Vandenberg
diff --git a/python-libcst.spec b/python-libcst.spec
index 69387d4..dc927e7 100644
--- a/python-libcst.spec
+++ b/python-libcst.spec
@@ -17,31 +17,39 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-Name: python-libcst
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+Name: python-libcst%{psuffix}
Version: 0.3.9
Release: 0
Summary: Python 3.5+ concrete syntax tree with AST-like properties
License: MIT
-Group: Development/Languages/Python
URL: https://github.com/Instagram/LibCST
Source: https://files.pythonhosted.org/packages/source/l/libcst/libcst-%{version}.tar.gz
Source1: https://raw.githubusercontent.com/Instagram/LibCST/master/libcst/codemod/tests/codemod_formatter_error_input.py.txt
+# all the deps over setuptools are for the generateor fix
+BuildRequires: %{python_module black}
+BuildRequires: %{python_module isort}
BuildRequires: %{python_module setuptools}
+BuildRequires: %{python_module typing-inspect >= 0.4.0}
+BuildRequires: %{python_module typing_extensions >= 3.7.4.2}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-PyYAML >= 5.2
Requires: python-typing-inspect >= 0.4.0
Requires: python-typing_extensions >= 3.7.4.2
BuildArch: noarch
-# SECTION test requirements
+%if %{with test}
BuildRequires: %{python_module PyYAML >= 5.2}
-BuildRequires: %{python_module black}
BuildRequires: %{python_module hypothesis >= 4.36.0}
BuildRequires: %{python_module hypothesmith >= 0.0.4}
-BuildRequires: %{python_module isort}
-BuildRequires: %{python_module typing_extensions >= 3.7.4.2}
-BuildRequires: %{python_module typing-inspect >= 0.4.0}
-# /SECTION
+%endif
%python_subpackages
%description
@@ -67,6 +75,7 @@ sed -i 's/"error: .* stack:",/"Transformed 1 files successfully.",/' libcst/code
%python_build
%install
+%if !%{with test}
%python_install
%{python_expand # https://github.com/Instagram/LibCST/issues/331
export PYTHONPATH=%{buildroot}%{$python_sitelib}
@@ -80,14 +89,19 @@ rm -r %{buildroot}%{$python_sitelib}/libcst/tests/ \
%fdupes %{buildroot}%{$python_sitelib}
}
+%endif
%check
+%if %{with test}
%python_exec -m unittest -v
+%endif
+%if !%{with test}
%files %{python_files}
%doc README.rst
%license LICENSE
%{python_sitelib}/libcst
%{python_sitelib}/libcst-%{version}-py*.egg-info
+%endif
%changelog