From 1bbbbb9e8a2ff58c6eae7dbdd6b78ea486f742c48044f0b5fa33746cc6b933bd Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 13 Jul 2022 01:48:20 +0000 Subject: [PATCH] - Update to 1.1.0: * Disable authentication of /metrics endpoint. (#1129) * read custom histogram latency buckets from env (#1134) * making PrometheusMetrics class singleton (#1149) * Fix attribute error caused by newest humanize package. (#1156) * pass sentinel_kwargs to Sentinel() broker (#1208) * Fixing CORS support (#1200) * Encode worker and task names in URL (#1204) * Add compatibility with older humanize versions (#1196) * Diable API if auth is enabled (#1225) - Remove patch python-flower-new-humanize.patch: * Included upstream. - Add patch remove-mock.patch: * Remove dependency on mock. - Remove python-mock from BuildRequires - Clean up python 2 bcond, it is no longer supported. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flower?expand=0&rev=15 --- flower-1.0.0.tar.gz | 3 - flower-1.1.0.tar.gz | 3 + python-flower-new-humanize.patch | 67 ----------------- python-flower.changes | 20 +++++ python-flower.spec | 15 +--- remove-mock.patch | 124 +++++++++++++++++++++++++++++++ 6 files changed, 150 insertions(+), 82 deletions(-) delete mode 100644 flower-1.0.0.tar.gz create mode 100644 flower-1.1.0.tar.gz delete mode 100644 python-flower-new-humanize.patch create mode 100644 remove-mock.patch diff --git a/flower-1.0.0.tar.gz b/flower-1.0.0.tar.gz deleted file mode 100644 index 458d6ac..0000000 --- a/flower-1.0.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2e17c4fb55c569508f3bfee7fe41f44b8362d30dbdf77b604a9d9f4740fe8cbd -size 4266671 diff --git a/flower-1.1.0.tar.gz b/flower-1.1.0.tar.gz new file mode 100644 index 0000000..4f61a6d --- /dev/null +++ b/flower-1.1.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f920ca2902d7539fc180ab15e51f1d918355e5cc23da854ff9d59c6e5a1725b6 +size 1974126 diff --git a/python-flower-new-humanize.patch b/python-flower-new-humanize.patch deleted file mode 100644 index 114d582..0000000 --- a/python-flower-new-humanize.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff --git a/flower/utils/__init__.py b/flower/utils/__init__.py -index 45289d51..29486ac9 100644 ---- a/flower/utils/__init__.py -+++ b/flower/utils/__init__.py -@@ -20,11 +20,11 @@ def bugreport(app=None): - return 'flower -> flower:%s tornado:%s humanize:%s%s' % ( - __version__, - tornado.version, -- humanize.VERSION, -+ humanize.__version__, - app.bugreport() - ) -- except (ImportError, AttributeError): -- return 'Unknown Celery version' -+ except (ImportError, AttributeError) as e: -+ return f"Error when generating bug report: {e}. Have you installed correct versions of Flower's dependencies?" - - - def abs_path(path): -diff --git a/requirements/default.txt b/requirements/default.txt -index 93c831ef..9ffa2f89 100644 ---- a/requirements/default.txt -+++ b/requirements/default.txt -@@ -1,5 +1,5 @@ - celery>=5.0.5 - tornado>=5.0.0,<7.0.0 - prometheus_client>=0.8.0 --humanize -+humanize==3.12.0 - pytz -diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py -index a0032619..4e4fada4 100644 ---- a/tests/unit/utils/test_utils.py -+++ b/tests/unit/utils/test_utils.py -@@ -1,4 +1,5 @@ - import unittest -+from unittest.mock import Mock - - from flower.utils import bugreport - from celery import Celery -@@ -7,7 +8,7 @@ - class BugreportTests(unittest.TestCase): - def test_default(self): - report = bugreport() -- self.assertFalse('Unknown Celery version' in report) -+ self.assertFalse('Error when generating bug report' in report) - self.assertTrue('tornado' in report) - self.assertTrue('humanize' in report) - self.assertTrue('celery' in report) -@@ -15,7 +16,15 @@ def test_default(self): - def test_with_app(self): - app = Celery() - report = bugreport(app) -- self.assertFalse('Unknown Celery version' in report) -+ self.assertFalse('Error when generating bug report' in report) - self.assertTrue('tornado' in report) - self.assertTrue('humanize' in report) - self.assertTrue('celery' in report) -+ -+ def test_when_unable_to_generate_report(self): -+ fake_app = Mock() -+ fake_app.bugreport.side_effect = ImportError('import error message') -+ report = bugreport(fake_app) -+ self.assertTrue('Error when generating bug report' in report) -+ self.assertTrue('import error message' in report) -+ self.assertTrue("Have you installed correct versions of Flower's dependencies?" in report) - diff --git a/python-flower.changes b/python-flower.changes index 52c6c4a..0f50076 100644 --- a/python-flower.changes +++ b/python-flower.changes @@ -1,3 +1,23 @@ +------------------------------------------------------------------- +Wed Jul 13 01:41:44 UTC 2022 - Steve Kowalik + +- Update to 1.1.0: + * Disable authentication of /metrics endpoint. (#1129) + * read custom histogram latency buckets from env (#1134) + * making PrometheusMetrics class singleton (#1149) + * Fix attribute error caused by newest humanize package. (#1156) + * pass sentinel_kwargs to Sentinel() broker (#1208) + * Fixing CORS support (#1200) + * Encode worker and task names in URL (#1204) + * Add compatibility with older humanize versions (#1196) + * Diable API if auth is enabled (#1225) +- Remove patch python-flower-new-humanize.patch: + * Included upstream. +- Add patch remove-mock.patch: + * Remove dependency on mock. +- Remove python-mock from BuildRequires +- Clean up python 2 bcond, it is no longer supported. + ------------------------------------------------------------------- Tue May 17 12:28:23 UTC 2022 - pgajdos@suse.com diff --git a/python-flower.spec b/python-flower.spec index 71773a2..882afcf 100644 --- a/python-flower.spec +++ b/python-flower.spec @@ -16,25 +16,22 @@ # -%bcond_without python2 Name: python-flower -Version: 1.0.0 +Version: 1.1.0 Release: 0 Summary: A web frontend for monitoring and administrating Celery clusters License: BSD-3-Clause -Group: Development/Languages/Python URL: https://github.com/mher/flower Source: https://files.pythonhosted.org/packages/source/f/flower/flower-%{version}.tar.gz # Tornado 5+ update blocked by salt, so backport the missing piece Patch0: backport_run_in_executor.patch -# https://github.com/mher/flower/commit/70b1ae40b467a3febab9abef3ef52dea56ca6f12 -Patch1: python-flower-new-humanize.patch +# PATCH-FIX-UPSTREAM gh#mher/flower#1228 +Patch1: remove-mock.patch BuildRequires: %{python_module Babel >= 1.0} BuildRequires: %{python_module celery >= 5.0.0} BuildRequires: %{python_module certifi} BuildRequires: %{python_module humanize} BuildRequires: %{python_module kombu} -BuildRequires: %{python_module mock} BuildRequires: %{python_module prometheus_client >= 0.8.0} BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytz} @@ -52,12 +49,6 @@ Requires: python-tornado >= 5.0.0 Requires(post): update-alternatives Requires(postun):update-alternatives BuildArch: noarch -%if %{with python2} -BuildRequires: python-futures -%endif -%ifpython2 -Requires: python-futures -%endif %python_subpackages %description diff --git a/remove-mock.patch b/remove-mock.patch new file mode 100644 index 0000000..6760ea1 --- /dev/null +++ b/remove-mock.patch @@ -0,0 +1,124 @@ +Index: flower-1.1.0/tests/unit/__init__.py +=================================================================== +--- flower-1.1.0.orig/tests/unit/__init__.py ++++ flower-1.1.0/tests/unit/__init__.py +@@ -1,3 +1,4 @@ ++from unittest import mock + from urllib.parse import urlencode + + import tornado.testing +@@ -6,7 +7,6 @@ from tornado.options import options + from tornado.concurrent import Future + + import celery +-import mock + + from flower.app import Flower + from flower.urls import handlers +Index: flower-1.1.0/tests/unit/api/test_control.py +=================================================================== +--- flower-1.1.0.orig/tests/unit/api/test_control.py ++++ flower-1.1.0/tests/unit/api/test_control.py +@@ -1,5 +1,4 @@ +-from mock import MagicMock +-import mock ++from unittest.mock import MagicMock, patch + from flower.api.control import ControlHandler + + from tests.unit import AsyncHTTPTestCase +@@ -174,7 +173,7 @@ class TaskControlTests(AsyncHTTPTestCase + + class ControlAuthTests(WorkerControlTests): + def test_auth(self): +- with mock.patch.object(options.mockable(), 'basic_auth', ['user1:password1']): ++ with patch.object(options.mockable(), 'basic_auth', ['user1:password1']): + app = self._app.capp + app.control.broadcast = MagicMock() + r = self.post('/api/worker/shutdown/test', body={}) +Index: flower-1.1.0/tests/unit/api/test_workers.py +=================================================================== +--- flower-1.1.0.orig/tests/unit/api/test_workers.py ++++ flower-1.1.0/tests/unit/api/test_workers.py +@@ -1,6 +1,6 @@ + import json + +-import mock ++from unittest import mock + + from flower.api.control import ControlHandler + from flower.inspector import Inspector +Index: flower-1.1.0/tests/unit/test_command.py +=================================================================== +--- flower-1.1.0.orig/tests/unit/test_command.py ++++ flower-1.1.0/tests/unit/test_command.py +@@ -5,7 +5,6 @@ import unittest + import subprocess + from unittest.mock import Mock, patch + +-import mock + from prometheus_client import Histogram + + from flower.command import apply_options, warn_about_celery_args_used_in_flower_command, apply_env_options +@@ -49,7 +48,7 @@ class TestFlowerCommand(AsyncHTTPTestCas + - create flower command + """ + celery_app = self._get_celery_app() +- with mock.patch.object(celery_app, '_autodiscover_tasks') as autodiscover: ++ with patch.object(celery_app, '_autodiscover_tasks') as autodiscover: + celery_app.autodiscover_tasks() + + self.get_app(capp=celery_app) +Index: flower-1.1.0/tests/unit/api/test_tasks.py +=================================================================== +--- flower-1.1.0.orig/tests/unit/api/test_tasks.py ++++ flower-1.1.0/tests/unit/api/test_tasks.py +@@ -1,4 +1,4 @@ +-from mock import Mock, patch ++from unittest.mock import Mock, patch + from datetime import datetime, timedelta + + from celery.result import AsyncResult +@@ -16,7 +16,7 @@ from collections import OrderedDict + + class ApplyTests(AsyncHTTPTestCase): + def test_apply(self): +- from mock import patch, PropertyMock ++ from unittest.mock import patch, PropertyMock + import json + + result = 'result' +Index: flower-1.1.0/tests/unit/utils/test_broker.py +=================================================================== +--- flower-1.1.0.orig/tests/unit/utils/test_broker.py ++++ flower-1.1.0/tests/unit/utils/test_broker.py +@@ -1,6 +1,6 @@ + import unittest + +-from mock import MagicMock ++from unittest.mock import MagicMock + + from flower.utils import broker + from flower.utils.broker import RabbitMQ, Redis, RedisBase, RedisSocket, Broker, RedisSentinel +Index: flower-1.1.0/tests/unit/views/test_dashboard.py +=================================================================== +--- flower-1.1.0.orig/tests/unit/views/test_dashboard.py ++++ flower-1.1.0/tests/unit/views/test_dashboard.py +@@ -1,17 +1,11 @@ + import time + import unittest +-import sys ++from unittest.mock import patch + + from tests.unit import AsyncHTTPTestCase + from tests.unit.utils import task_succeeded_events, task_failed_events + from tests.unit.utils import HtmlTableParser + +-if sys.version_info >= (2, 7): +- from mock import patch +-else: +- from unittest.mock import patch +- +- + from celery.events import Event + from celery.utils import uuid +