diff --git a/_multibuild b/_multibuild
index fcc7b97..6222fa7 100644
--- a/_multibuild
+++ b/_multibuild
@@ -1,3 +1,4 @@
test
+ wheel
diff --git a/python-setuptools.changes b/python-setuptools.changes
index 9c36e5c..18fb506 100644
--- a/python-setuptools.changes
+++ b/python-setuptools.changes
@@ -1,3 +1,21 @@
+-------------------------------------------------------------------
+Mon Nov 16 14:02:34 UTC 2020 - Matej Cepl
+
+- Avoid duplicite wheel name in the generated package, and we actually
+ don't need a subpackage at all.
+
+-------------------------------------------------------------------
+Thu Nov 12 16:09:08 UTC 2020 - Matej Cepl
+
+- Make wheel a separate build run to avoid the setuptools/wheel build
+ cycle.
+
+-------------------------------------------------------------------
+Tue Nov 10 09:21:02 UTC 2020 - Matej Cepl
+
+- Add wheel subpackage with the generated wheel for this package
+ (bsc#1176262, CVE-2019-20916).
+
-------------------------------------------------------------------
Thu Aug 13 11:03:41 UTC 2020 - Ondřej Súkup
diff --git a/python-setuptools.spec b/python-setuptools.spec
index 70168b2..95f4812 100644
--- a/python-setuptools.spec
+++ b/python-setuptools.spec
@@ -22,9 +22,16 @@
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
+%bcond_with wheel
+%else
+%if "%{flavor}" == "wheel"
+%define psuffix -wheel
+%bcond_without wheel
%else
%define psuffix %{nil}
%bcond_with test
+%bcond_with wheel
+%endif
%endif
%bcond_without python2
Name: python-setuptools%{psuffix}
@@ -80,6 +87,9 @@ Recommends: ca-certificates-mozilla
Provides: %{oldpython}-distribute = %{version}
Obsoletes: %{oldpython}-distribute < %{version}
%endif
+%if %{with wheel}
+BuildRequires: %{python_module wheel}
+%endif
%python_subpackages
%description
@@ -121,15 +131,24 @@ find ./ -type f -name \*.py -exec sed -i \
{} \;
%build
+%if ! %{with wheel}
%python_build
+%else
+%python_exec setup.py bdist_wheel --universal
+%endif
%install
-%if !%{with test}
+%if !%{with test} && !%{with wheel}
%python_install
%prepare_alternative easy_install
+
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
+%if %{with wheel}
+%python_expand install -D -m 0644 -t %{buildroot}%{$python_sitelib}/../wheels dist/*.whl
+%endif
+
%check
%if %{with test}
# the 4 skipped test rely on the bundled packages but they are
@@ -140,14 +159,16 @@ export PYTHONPATH=$(pwd)
%pytest -k 'not (test_clean_env_install or test_pip_upgrade_from_source or test_test_command_install_requirements or test_no_missing_dependencies)'
%endif
-%if !%{with test}
+%if !%{with test} && !%{with wheel}
%post
%python_install_alternative easy_install
%postun
%python_uninstall_alternative easy_install
+%endif
%files %{python_files}
+%if !%{with test} && !%{with wheel}
%license LICENSE
%doc CHANGES.rst README.rst
%python_alternative %{_bindir}/easy_install
@@ -159,4 +180,9 @@ export PYTHONPATH=$(pwd)
%{python_sitelib}/pkg_resources/*
%endif
+%if %{with wheel}
+%dir %{python_sitelib}/../wheels
+%{python_sitelib}/../wheels/*
+%endif
+
%changelog