From 8d5933759eb177c3ac9a38b6c178d26aef5f7d5126c39e3e189f65ed6dd5e5eb Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 16 Mar 2022 20:49:26 +0000 Subject: [PATCH] Accepting request 962189 from home:pgajdos:python - do not require python-mock for build - added patches fix https://github.com/google/python-fire/pull/265/files + python-fire-no-mock.patch OBS-URL: https://build.opensuse.org/request/show/962189 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-fire?expand=0&rev=21 --- python-fire-no-mock.patch | 83 +++++++++++++++++++++++++++++++++++++++ python-fire.changes | 8 ++++ python-fire.spec | 6 ++- 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 python-fire-no-mock.patch diff --git a/python-fire-no-mock.patch b/python-fire-no-mock.patch new file mode 100644 index 0000000..029aaff --- /dev/null +++ b/python-fire-no-mock.patch @@ -0,0 +1,83 @@ +Index: fire-0.4.0/fire/core_test.py +=================================================================== +--- fire-0.4.0.orig/fire/core_test.py 2020-04-03 19:14:51.000000000 +0200 ++++ fire-0.4.0/fire/core_test.py 2022-03-16 13:48:27.568077390 +0100 +@@ -22,7 +22,11 @@ from fire import core + from fire import test_components as tc + from fire import testutils + from fire import trace +-import mock ++ ++try: ++ import mock # python 2.x ++except ModuleNotFoundError: ++ from unittest import mock # python 3.x + + import six + +Index: fire-0.4.0/fire/fire_import_test.py +=================================================================== +--- fire-0.4.0.orig/fire/fire_import_test.py 2022-03-16 13:48:27.568077390 +0100 ++++ fire-0.4.0/fire/fire_import_test.py 2022-03-16 13:51:27.561140579 +0100 +@@ -18,7 +18,11 @@ import sys + + import fire + from fire import testutils +-import mock ++ ++try: ++ import mock # python 2.x ++except ModuleNotFoundError: ++ from unittest import mock # python 3.x + + + class FireImportTest(testutils.BaseTestCase): +Index: fire-0.4.0/fire/fire_test.py +=================================================================== +--- fire-0.4.0.orig/fire/fire_test.py 2020-12-17 01:20:39.000000000 +0100 ++++ fire-0.4.0/fire/fire_test.py 2022-03-16 13:48:27.568077390 +0100 +@@ -25,7 +25,10 @@ import fire + from fire import test_components as tc + from fire import testutils + +-import mock ++try: ++ import mock # python 2.x ++except ModuleNotFoundError: ++ from unittest import mock # python 3.x + import six + + +Index: fire-0.4.0/fire/interact_test.py +=================================================================== +--- fire-0.4.0.orig/fire/interact_test.py 2022-03-16 13:48:27.568077390 +0100 ++++ fire-0.4.0/fire/interact_test.py 2022-03-16 13:50:36.080836493 +0100 +@@ -21,8 +21,10 @@ from __future__ import print_function + from fire import interact + from fire import testutils + +-import mock +- ++try: ++ import mock # python 2.x ++except ModuleNotFoundError: ++ from unittest import mock # python 3.x + + try: + import IPython # pylint: disable=unused-import, g-import-not-at-top +Index: fire-0.4.0/fire/testutils.py +=================================================================== +--- fire-0.4.0.orig/fire/testutils.py 2020-12-17 01:20:39.000000000 +0100 ++++ fire-0.4.0/fire/testutils.py 2022-03-16 13:48:27.568077390 +0100 +@@ -28,7 +28,10 @@ import unittest + from fire import core + from fire import trace + +-import mock ++try: ++ import mock # python 2.x ++except ModuleNotFoundError: ++ from unittest import mock # python 3.x + import six + + diff --git a/python-fire.changes b/python-fire.changes index 26a708d..08ec651 100644 --- a/python-fire.changes +++ b/python-fire.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Mar 16 12:52:10 UTC 2022 - pgajdos@suse.com + +- do not require python-mock for build +- added patches + fix https://github.com/google/python-fire/pull/265/files + + python-fire-no-mock.patch + ------------------------------------------------------------------- Fri Mar 12 04:41:30 UTC 2021 - Steve Kowalik diff --git a/python-fire.spec b/python-fire.spec index 3c9ec67..7d68a8d 100644 --- a/python-fire.spec +++ b/python-fire.spec @@ -1,7 +1,7 @@ # # spec file for package python-fire # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,6 +17,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define skip_python2 1 Name: python-fire Version: 0.4.0 Release: 0 @@ -24,6 +25,8 @@ Summary: A library for automatically generating command line interfaces License: Apache-2.0 URL: https://github.com/google/python-fire Source: https://files.pythonhosted.org/packages/source/f/fire/fire-%{version}.tar.gz +# https://github.com/google/python-fire/pull/265/files +Patch0: python-fire-no-mock.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -33,7 +36,6 @@ BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module Levenshtein} BuildRequires: %{python_module hypothesis} -BuildRequires: %{python_module mock} BuildRequires: %{python_module pytest} BuildRequires: %{python_module six} BuildRequires: %{python_module termcolor}