From 471d59678da485b1f2a2c676cebf6794cc6aaa9baf02e83ea2119d99d1dd907d Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 10 Mar 2022 10:39:20 +0000 Subject: [PATCH] Accepting request 960476 from home:pgajdos:python - do not require mock for build - added patches https://github.com/ros-infrastructure/catkin_pkg/commit/b5c6812b40fa31da91ee560dda7c6e470dedcfb8 + python-catkin-pkg-no-mock.patch OBS-URL: https://build.opensuse.org/request/show/960476 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-catkin-pkg?expand=0&rev=14 --- python-catkin-pkg-no-mock.patch | 74 +++++++++++++++++++++++++++++++++ python-catkin-pkg.changes | 8 ++++ python-catkin-pkg.spec | 6 ++- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 python-catkin-pkg-no-mock.patch diff --git a/python-catkin-pkg-no-mock.patch b/python-catkin-pkg-no-mock.patch new file mode 100644 index 0000000..2d1d1e9 --- /dev/null +++ b/python-catkin-pkg-no-mock.patch @@ -0,0 +1,74 @@ +diff --git a/test/test_package.py b/test/test_package.py +index 98420c5..1a417b0 100644 +--- a/test/test_package.py ++++ b/test/test_package.py +@@ -20,7 +20,10 @@ + Person, + ) + +-from mock import Mock ++try: ++ from unittest.mock import Mock ++except ImportError: ++ from mock import Mock + + sys.stderr = sys.stdout + +diff --git a/test/test_package_version.py b/test/test_package_version.py +index 6265347..190802b 100644 +--- a/test/test_package_version.py ++++ b/test/test_package_version.py +@@ -9,7 +9,10 @@ + from catkin_pkg.package_version import update_changelog_sections + from catkin_pkg.package_version import update_versions + +-import mock ++try: ++ from unittest.mock import Mock ++except ImportError: ++ from mock import Mock + + from .util import in_temporary_directory + +@@ -69,7 +72,7 @@ def test_update_changelog_unicode(self, directory=None): + temp_file = os.path.join(directory, 'changelog') + missing_changelogs_but_forthcoming = {} + # Mock the Changelog object from catkin_pkg +- mock_changelog = mock.Mock() ++ mock_changelog = Mock() + # Create a changelog entry with a unicode char. + mock_changelog.rst = ('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n' + 'Changelog for package fake_pkg\n' +diff --git a/test/test_templates.py b/test/test_templates.py +index 561ec28..164f1b1 100644 +--- a/test/test_templates.py ++++ b/test/test_templates.py +@@ -8,7 +8,10 @@ + create_cmakelists, create_package_files, create_package_xml, PackageTemplate + from catkin_pkg.python_setup import generate_distutils_setup + +-from mock import MagicMock, Mock ++try: ++ from unittest.mock import MagicMock, Mock ++except ImportError: ++ from mock import MagicMock, Mock + + + def u(line): +diff --git a/test/test_topological_order.py b/test/test_topological_order.py +index 651cb6b..88f44b4 100644 +--- a/test/test_topological_order.py ++++ b/test/test_topological_order.py +@@ -3,7 +3,10 @@ + import sys + import unittest + +-from mock import Mock ++try: ++ from mock import Mock ++except ImportError: ++ from unittest.mock import Mock + + try: + from catkin_pkg.topological_order import topological_order_packages, _PackageDecorator, \ + diff --git a/python-catkin-pkg.changes b/python-catkin-pkg.changes index 6f703fc..378fbff 100644 --- a/python-catkin-pkg.changes +++ b/python-catkin-pkg.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Mar 9 11:43:28 UTC 2022 - pgajdos@suse.com + +- do not require mock for build +- added patches + https://github.com/ros-infrastructure/catkin_pkg/commit/b5c6812b40fa31da91ee560dda7c6e470dedcfb8 + + python-catkin-pkg-no-mock.patch + ------------------------------------------------------------------- Sat Jan 15 18:34:37 UTC 2022 - Dirk Müller diff --git a/python-catkin-pkg.spec b/python-catkin-pkg.spec index 5ceedcf..b17640a 100644 --- a/python-catkin-pkg.spec +++ b/python-catkin-pkg.spec @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define commands create_pkg find_pkg generate_changelog package_version prepare_release tag_changelog test_changelog - +%define skip_python2 1 Name: python-catkin-pkg Version: 0.4.24 Release: 0 @@ -26,6 +26,8 @@ Summary: Catkin package library License: BSD-3-Clause URL: https://wiki.ros.org/catkin_pkg Source: https://github.com/ros-infrastructure/catkin_pkg/archive/%{version}.tar.gz +# https://github.com/ros-infrastructure/catkin_pkg/commit/b5c6812b40fa31da91ee560dda7c6e470dedcfb8.diff +Patch0: python-catkin-pkg-no-mock.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -39,7 +41,6 @@ BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module docutils} BuildRequires: %{python_module flake8} -BuildRequires: %{python_module mock} BuildRequires: %{python_module pyparsing} BuildRequires: %{python_module pytest} BuildRequires: %{python_module python-dateutil} @@ -51,6 +52,7 @@ Library for retrieving information about catkin packages. %prep %setup -q -n catkin_pkg-%{version} +%autopatch -p1 %build %python_build