From 5f25fbccb354050c7516e591eb47a7be2e2b7827 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Mon, 14 Oct 2024 14:38:44 +0200 Subject: [PATCH] python, cli: drop six dependency --- cli/copr_cli/main.py | 7 +++---- cli/tests/cli_tests_lib.py | 7 +++---- cli/tests/test_mock_config.py | 2 -- python/copr/test/__init__.py | 7 ++----- python/python-copr.spec | 6 ------ python/setup.py | 1 - 6 files changed, 8 insertions(+), 22 deletions(-) diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py index 54348cf85..2d9a2c328 100644 --- a/cli/copr_cli/main.py +++ b/cli/copr_cli/main.py @@ -13,7 +13,6 @@ import warnings from collections import defaultdict -import six import requests try: @@ -39,10 +38,10 @@ from .build_config import MockProfile -if six.PY2: - from urlparse import urljoin, urlparse -else: +try: from urllib.parse import urljoin, urlparse +except ImportError: + from urlparse import urljoin, urlparse log = logging.getLogger(__name__) diff --git a/cli/tests/cli_tests_lib.py b/cli/tests/cli_tests_lib.py index bc3451437..37e10ea2b 100644 --- a/cli/tests/cli_tests_lib.py +++ b/cli/tests/cli_tests_lib.py @@ -1,11 +1,9 @@ -import six - # pylint: disable=ungrouped-imports -if six.PY3: +try: from unittest import mock from unittest.mock import MagicMock from pytest import fixture -else: +except ImportError: import mock from mock import MagicMock from pytest import yield_fixture as fixture @@ -18,6 +16,7 @@ "token": "abc", } + @fixture def f_test_config(): with mock.patch('copr_cli.main.config_from_file', diff --git a/cli/tests/test_mock_config.py b/cli/tests/test_mock_config.py index 427763ab6..7566b9fad 100644 --- a/cli/tests/test_mock_config.py +++ b/cli/tests/test_mock_config.py @@ -6,8 +6,6 @@ from copr_cli import main -import six - from cli_tests_lib import mock, f_test_config, fixture diff --git a/python/copr/test/__init__.py b/python/copr/test/__init__.py index 23100cea7..1f8150191 100644 --- a/python/copr/test/__init__.py +++ b/python/copr/test/__init__.py @@ -3,16 +3,13 @@ """ import os -import six - path = os.path.abspath(__file__) dir_path = os.path.dirname(path) resource_location = os.path.join(dir_path, "resources") config_location = os.path.join(resource_location, "copr_cli.conf") -# We need to maintain python2 compatibility for EPEL7 -if six.PY3: +try: from unittest import mock -else: +except ImportError: import mock diff --git a/python/python-copr.spec b/python/python-copr.spec index ad1b0ebb0..df537acaa 100644 --- a/python/python-copr.spec +++ b/python/python-copr.spec @@ -29,7 +29,6 @@ BuildRequires: util-linux BuildRequires: python-setuptools BuildRequires: python-requests BuildRequires: python-requests-toolbelt -BuildRequires: python-six >= 1.9.0 BuildRequires: python-mock BuildRequires: python-munch BuildRequires: python-filelock @@ -44,7 +43,6 @@ BuildRequires: python-docutils BuildRequires: python2-setuptools BuildRequires: python2-requests BuildRequires: python2-requests-toolbelt -BuildRequires: python2-six >= 1.9.0 BuildRequires: python2-pytest BuildRequires: python2-devel BuildRequires: python-munch @@ -81,7 +79,6 @@ Requires: python-requests Requires: python-requests-toolbelt Requires: python-requests-gssapi Requires: python-setuptools -Requires: python-six >= 1.9.0 %else Requires: python2-configparser Requires: python2-munch @@ -90,7 +87,6 @@ Requires: python2-requests Requires: python2-requests-toolbelt Requires: python2-setuptools Requires: python2-requests-gssapi -Requires: python2-six >= 1.9.0 %endif %{?python_provide:%python_provide python2-copr} @@ -114,7 +110,6 @@ BuildRequires: python3-pytest BuildRequires: python3-setuptools BuildRequires: python3-requests BuildRequires: python3-requests-toolbelt -BuildRequires: python3-six BuildRequires: python3-sphinx BuildRequires: python3-requests-gssapi @@ -123,7 +118,6 @@ Requires: python3-filelock Requires: python3-requests Requires: python3-requests-toolbelt Requires: python3-setuptools -Requires: python3-six Requires: python3-requests-gssapi %{?python_provide:%python_provide python3-copr} diff --git a/python/setup.py b/python/setup.py index 95c4ca489..94a9decaa 100644 --- a/python/setup.py +++ b/python/setup.py @@ -18,7 +18,6 @@ 'requests', 'requests-toolbelt', 'setuptools', - 'six', 'munch', ]