Remove colorama patches
Resolves: RHEL-14523 Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
parent
53e1810c55
commit
ab99efed93
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/aws-cli-2.15.31.tar.gz
|
/aws-cli-2.15.31.tar.gz
|
||||||
|
/aws-cli-2.15.47.tar.gz
|
||||||
|
@ -1,269 +0,0 @@
|
|||||||
From 0fd1ede2fd0c1898ff8360afd210c4ff3d22034f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Major Hayden <major@mhtx.net>
|
|
||||||
Date: Wed, 1 May 2024 08:42:55 -0500
|
|
||||||
Subject: [PATCH] Remove colorama
|
|
||||||
|
|
||||||
---
|
|
||||||
awscli/customizations/configure/sso.py | 5 ++--
|
|
||||||
awscli/customizations/history/show.py | 11 +------
|
|
||||||
awscli/customizations/logs/tail.py | 10 ++-----
|
|
||||||
awscli/formatter.py | 3 +-
|
|
||||||
awscli/table.py | 29 +------------------
|
|
||||||
exe/pyinstaller/hook-awscli.py | 1 -
|
|
||||||
pyproject.toml | 3 +-
|
|
||||||
.../build_system/functional/test_utils.py | 4 ---
|
|
||||||
tests/backends/test_pep517.py | 1 -
|
|
||||||
tests/dependencies/test_closure.py | 1 -
|
|
||||||
10 files changed, 8 insertions(+), 60 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/awscli/customizations/configure/sso.py b/awscli/customizations/configure/sso.py
|
|
||||||
index 5a650a367..881cc9bd5 100644
|
|
||||||
--- a/awscli/customizations/configure/sso.py
|
|
||||||
+++ b/awscli/customizations/configure/sso.py
|
|
||||||
@@ -17,7 +17,6 @@ import os
|
|
||||||
import logging
|
|
||||||
import re
|
|
||||||
|
|
||||||
-import colorama
|
|
||||||
from botocore import UNSIGNED
|
|
||||||
from botocore.config import Config
|
|
||||||
from botocore.configprovider import ConstantProvider
|
|
||||||
@@ -619,10 +618,10 @@ class ConfigureSSOCommand(BaseSSOConfigurationCommand):
|
|
||||||
|
|
||||||
def _warn_configuring_using_legacy_format(self):
|
|
||||||
uni_print(
|
|
||||||
- f'{colorama.Style.BRIGHT}WARNING: Configuring using legacy format '
|
|
||||||
+ f'WARNING: Configuring using legacy format '
|
|
||||||
f'(e.g. without an SSO session).\n'
|
|
||||||
f'Consider re-running "configure sso" command and providing '
|
|
||||||
- f'a session name.\n{colorama.Style.RESET_ALL}'
|
|
||||||
+ f'a session name.\n'
|
|
||||||
)
|
|
||||||
|
|
||||||
def _prompt_for_sso_account_and_role(self, sso, sso_token):
|
|
||||||
diff --git a/awscli/customizations/history/show.py b/awscli/customizations/history/show.py
|
|
||||||
index 587bc13de..0eac9f7db 100644
|
|
||||||
--- a/awscli/customizations/history/show.py
|
|
||||||
+++ b/awscli/customizations/history/show.py
|
|
||||||
@@ -16,8 +16,6 @@ import sys
|
|
||||||
import xml.parsers.expat
|
|
||||||
import xml.dom.minidom
|
|
||||||
|
|
||||||
-import colorama
|
|
||||||
-
|
|
||||||
from awscli.table import COLORAMA_KWARGS
|
|
||||||
from awscli.compat import six
|
|
||||||
from awscli.customizations.history.commands import HistorySubcommand
|
|
||||||
@@ -169,19 +167,12 @@ class DetailedFormatter(Formatter):
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
- _COMPONENT_COLORS = {
|
|
||||||
- 'title': colorama.Style.BRIGHT,
|
|
||||||
- 'description': colorama.Fore.CYAN
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
def __init__(self, output=None, include=None, exclude=None, colorize=True):
|
|
||||||
super(DetailedFormatter, self).__init__(output, include, exclude)
|
|
||||||
self._request_id_to_api_num = {}
|
|
||||||
self._num_api_calls = 0
|
|
||||||
self._colorize = colorize
|
|
||||||
self._value_pformatter = SectionValuePrettyFormatter()
|
|
||||||
- if self._colorize:
|
|
||||||
- colorama.init(**COLORAMA_KWARGS)
|
|
||||||
|
|
||||||
def _display(self, event_record):
|
|
||||||
section_definition = self._SECTIONS.get(event_record['event_type'])
|
|
||||||
@@ -254,7 +245,7 @@ class DetailedFormatter(Formatter):
|
|
||||||
def _color_if_configured(self, text, component):
|
|
||||||
if self._colorize:
|
|
||||||
color = self._COMPONENT_COLORS[component]
|
|
||||||
- return color + text + colorama.Style.RESET_ALL
|
|
||||||
+ return color + text
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/awscli/customizations/logs/tail.py b/awscli/customizations/logs/tail.py
|
|
||||||
index cb3151003..3a26827c5 100644
|
|
||||||
--- a/awscli/customizations/logs/tail.py
|
|
||||||
+++ b/awscli/customizations/logs/tail.py
|
|
||||||
@@ -18,7 +18,6 @@ import time
|
|
||||||
|
|
||||||
from botocore.utils import parse_timestamp, datetime2timestamp
|
|
||||||
from dateutil import tz
|
|
||||||
-import colorama
|
|
||||||
|
|
||||||
from awscli.compat import get_stdout_text_writer
|
|
||||||
from awscli.utils import is_a_tty
|
|
||||||
@@ -27,21 +26,16 @@ from awscli.customizations.commands import BasicCommand
|
|
||||||
|
|
||||||
class BaseLogEventsFormatter(object):
|
|
||||||
|
|
||||||
- _TIMESTAMP_COLOR = colorama.Fore.GREEN
|
|
||||||
- _STREAM_NAME_COLOR = colorama.Fore.CYAN
|
|
||||||
-
|
|
||||||
- def __init__(self, output, colorize=True):
|
|
||||||
+ def __init__(self, output, colorize=False):
|
|
||||||
self._output = output
|
|
||||||
self._colorize = colorize
|
|
||||||
- if self._colorize:
|
|
||||||
- colorama.init(autoreset=True, strip=False)
|
|
||||||
|
|
||||||
def display_log_event(self, log_event):
|
|
||||||
raise NotImplementedError('display_log_event()')
|
|
||||||
|
|
||||||
def _color_if_configured(self, text, color):
|
|
||||||
if self._colorize:
|
|
||||||
- return color + text + colorama.Style.RESET_ALL
|
|
||||||
+ return color + text
|
|
||||||
return text
|
|
||||||
|
|
||||||
def _write_log_event(self, log_event):
|
|
||||||
diff --git a/awscli/formatter.py b/awscli/formatter.py
|
|
||||||
index 78566dd35..38f003859 100644
|
|
||||||
--- a/awscli/formatter.py
|
|
||||||
+++ b/awscli/formatter.py
|
|
||||||
@@ -18,7 +18,7 @@ from botocore.utils import set_value_from_jmespath
|
|
||||||
from botocore.paginate import PageIterator
|
|
||||||
from ruamel.yaml import YAML
|
|
||||||
|
|
||||||
-from awscli.table import MultiTable, Styler, ColorizedStyler
|
|
||||||
+from awscli.table import MultiTable, Styler
|
|
||||||
from awscli import text
|
|
||||||
from awscli import compat
|
|
||||||
from awscli.utils import json_encoder
|
|
||||||
@@ -206,7 +206,6 @@ class TableFormatter(FullyBufferedFormatter):
|
|
||||||
self.table = MultiTable(initial_section=False,
|
|
||||||
column_separator='|', styler=styler)
|
|
||||||
elif args.color == 'on':
|
|
||||||
- styler = ColorizedStyler()
|
|
||||||
self.table = MultiTable(initial_section=False,
|
|
||||||
column_separator='|', styler=styler)
|
|
||||||
else:
|
|
||||||
diff --git a/awscli/table.py b/awscli/table.py
|
|
||||||
index df96392fc..ba3cfb9d0 100644
|
|
||||||
--- a/awscli/table.py
|
|
||||||
+++ b/awscli/table.py
|
|
||||||
@@ -14,8 +14,6 @@ import sys
|
|
||||||
import struct
|
|
||||||
import unicodedata
|
|
||||||
|
|
||||||
-import colorama
|
|
||||||
-
|
|
||||||
from awscli.utils import is_a_tty
|
|
||||||
from awscli.compat import six
|
|
||||||
|
|
||||||
@@ -161,28 +159,6 @@ class Styler(object):
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
-class ColorizedStyler(Styler):
|
|
||||||
- def __init__(self):
|
|
||||||
- colorama.init(**COLORAMA_KWARGS)
|
|
||||||
-
|
|
||||||
- def style_title(self, text):
|
|
||||||
- # Originally bold + underline
|
|
||||||
- return text
|
|
||||||
- #return colorama.Style.BOLD + text + colorama.Style.RESET_ALL
|
|
||||||
-
|
|
||||||
- def style_header_column(self, text):
|
|
||||||
- # Originally underline
|
|
||||||
- return text
|
|
||||||
-
|
|
||||||
- def style_row_element(self, text):
|
|
||||||
- return (colorama.Style.BRIGHT + colorama.Fore.BLUE +
|
|
||||||
- text + colorama.Style.RESET_ALL)
|
|
||||||
-
|
|
||||||
- def style_indentation_char(self, text):
|
|
||||||
- return (colorama.Style.DIM + colorama.Fore.YELLOW +
|
|
||||||
- text + colorama.Style.RESET_ALL)
|
|
||||||
-
|
|
||||||
-
|
|
||||||
class MultiTable(object):
|
|
||||||
def __init__(self, terminal_width=None, initial_section=True,
|
|
||||||
column_separator='|', terminal=None,
|
|
||||||
@@ -196,10 +172,7 @@ class MultiTable(object):
|
|
||||||
self._sections = []
|
|
||||||
if styler is None:
|
|
||||||
# Move out to factory.
|
|
||||||
- if is_a_tty():
|
|
||||||
- self._styler = ColorizedStyler()
|
|
||||||
- else:
|
|
||||||
- self._styler = Styler()
|
|
||||||
+ self._styler = Styler()
|
|
||||||
else:
|
|
||||||
self._styler = styler
|
|
||||||
self._rendering_index = 0
|
|
||||||
diff --git a/exe/pyinstaller/hook-awscli.py b/exe/pyinstaller/hook-awscli.py
|
|
||||||
index 617b71d92..2ea109556 100644
|
|
||||||
--- a/exe/pyinstaller/hook-awscli.py
|
|
||||||
+++ b/exe/pyinstaller/hook-awscli.py
|
|
||||||
@@ -9,7 +9,6 @@ hiddenimports = [
|
|
||||||
'configparser',
|
|
||||||
'xml.etree',
|
|
||||||
'pipes',
|
|
||||||
- 'colorama',
|
|
||||||
'awscli.handlers',
|
|
||||||
# NOTE: This can be removed once this hidden import issue related to
|
|
||||||
# setuptools and PyInstaller is resolved:
|
|
||||||
diff --git a/pyproject.toml b/pyproject.toml
|
|
||||||
index 76c757b68..4d4165444 100644
|
|
||||||
--- a/pyproject.toml
|
|
||||||
+++ b/pyproject.toml
|
|
||||||
@@ -28,7 +28,6 @@ classifiers = [
|
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
]
|
|
||||||
dependencies = [
|
|
||||||
- "colorama>=0.2.5,<0.4.7",
|
|
||||||
"docutils>=0.10,<0.20",
|
|
||||||
"cryptography>=3.3.2,<40.0.2",
|
|
||||||
"ruamel.yaml>=0.15.0,<=0.17.21",
|
|
||||||
@@ -98,4 +97,4 @@ filterwarnings = [
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.black]
|
|
||||||
-line-length = 80
|
|
||||||
\ No newline at end of file
|
|
||||||
+line-length = 80
|
|
||||||
diff --git a/tests/backends/build_system/functional/test_utils.py b/tests/backends/build_system/functional/test_utils.py
|
|
||||||
index 683cc7ab2..c93b0074e 100644
|
|
||||||
--- a/tests/backends/build_system/functional/test_utils.py
|
|
||||||
+++ b/tests/backends/build_system/functional/test_utils.py
|
|
||||||
@@ -39,10 +39,6 @@ def utils():
|
|
||||||
"flit_core>=3.7.1,<3.7.2",
|
|
||||||
Requirement("flit_core", ">=3.7.1", "<3.7.2"),
|
|
||||||
),
|
|
||||||
- (
|
|
||||||
- "colorama>=0.2.5,<0.4.4",
|
|
||||||
- Requirement("colorama", ">=0.2.5", "<0.4.4"),
|
|
||||||
- ),
|
|
||||||
("docutils>=0.10,<0.16", Requirement("docutils", ">=0.10", "<0.16")),
|
|
||||||
(
|
|
||||||
"cryptography>=3.3.2,<37.0.0",
|
|
||||||
diff --git a/tests/backends/test_pep517.py b/tests/backends/test_pep517.py
|
|
||||||
index 5f60e04eb..ef763c81a 100644
|
|
||||||
--- a/tests/backends/test_pep517.py
|
|
||||||
+++ b/tests/backends/test_pep517.py
|
|
||||||
@@ -242,7 +242,6 @@ def test_get_requires_for_build_wheel(config_settings, repo_root):
|
|
||||||
config_settings
|
|
||||||
)
|
|
||||||
expected_requirements = [
|
|
||||||
- "colorama",
|
|
||||||
"docutils",
|
|
||||||
"cryptography",
|
|
||||||
"ruamel.yaml",
|
|
||||||
diff --git a/tests/dependencies/test_closure.py b/tests/dependencies/test_closure.py
|
|
||||||
index 6231438cd..fcb38c591 100644
|
|
||||||
--- a/tests/dependencies/test_closure.py
|
|
||||||
+++ b/tests/dependencies/test_closure.py
|
|
||||||
@@ -139,7 +139,6 @@ class TestDependencyClosure:
|
|
||||||
expected_dependencies = {
|
|
||||||
"awscrt",
|
|
||||||
"cffi",
|
|
||||||
- "colorama",
|
|
||||||
"cryptography",
|
|
||||||
"distro",
|
|
||||||
"docutils",
|
|
||||||
--
|
|
||||||
2.44.0
|
|
||||||
|
|
92
awscli2.spec
92
awscli2.spec
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Name: awscli2
|
Name: awscli2
|
||||||
Version: 2.15.31
|
Version: 2.15.31
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
|
|
||||||
Summary: Universal Command Line Environment for AWS, version 2
|
Summary: Universal Command Line Environment for AWS, version 2
|
||||||
# all files are licensed under Apache-2.0, except:
|
# all files are licensed under Apache-2.0, except:
|
||||||
@ -14,34 +14,24 @@ License: Apache-2.0 AND MIT
|
|||||||
URL: https://github.com/aws/aws-cli/tree/v2
|
URL: https://github.com/aws/aws-cli/tree/v2
|
||||||
Source0: https://github.com/aws/aws-cli/archive/%{version}/%{pkgname}-%{version}.tar.gz
|
Source0: https://github.com/aws/aws-cli/archive/%{version}/%{pkgname}-%{version}.tar.gz
|
||||||
|
|
||||||
# Remove colorama dependency.
|
|
||||||
Patch: awscli2-remove-colorama.patch
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
BuildRequires: pyproject-rpm-macros
|
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
BuildRequires: python3-pip
|
|
||||||
BuildRequires: python-unversioned-command
|
BuildRequires: python-unversioned-command
|
||||||
BuildRequires: procps-ng
|
BuildRequires: procps-ng
|
||||||
|
|
||||||
BuildRequires: python3dist(awscrt)
|
|
||||||
BuildRequires: python3dist(cryptography)
|
|
||||||
BuildRequires: python3dist(distro)
|
|
||||||
BuildRequires: python3dist(docutils)
|
|
||||||
BuildRequires: python3dist(flit-core)
|
|
||||||
BuildRequires: python3dist(jmespath)
|
|
||||||
BuildRequires: python3dist(prompt-toolkit)
|
|
||||||
BuildRequires: python3dist(python-dateutil)
|
|
||||||
BuildRequires: python3dist(ruamel-yaml-clib)
|
|
||||||
BuildRequires: python3dist(urllib3)
|
|
||||||
|
|
||||||
%if %{with tests}
|
|
||||||
BuildRequires: python3dist(pytest)
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Recommends: groff
|
Recommends: groff
|
||||||
|
|
||||||
|
Provides: bundled(python3dist(botocore)) = 2.0.0
|
||||||
|
Provides: bundled(python3dist(s3transfer)) = 0.5.1
|
||||||
|
|
||||||
|
Provides: awscli = %{version}-%{release}
|
||||||
|
Obsoletes: awscli < 2
|
||||||
|
|
||||||
|
# provide an upgrade path from awscli-2 (Amazon Linux)
|
||||||
|
Provides: awscli-2 = %{version}-%{release}
|
||||||
|
Obsoletes: awscli-2 < %{version}-%{release}
|
||||||
|
|
||||||
# python-awscrt does not build on s390x
|
# python-awscrt does not build on s390x
|
||||||
ExcludeArch: s390x
|
ExcludeArch: s390x
|
||||||
|
|
||||||
@ -57,6 +47,9 @@ interface to Amazon Web Services.
|
|||||||
# fix permissions
|
# fix permissions
|
||||||
find awscli/examples/ -type f -name '*.rst' -executable -exec chmod -x '{}' +
|
find awscli/examples/ -type f -name '*.rst' -executable -exec chmod -x '{}' +
|
||||||
|
|
||||||
|
# remove version caps on dependencies
|
||||||
|
sed -i 's/,<=\?[^"]*"/"/' pyproject.toml
|
||||||
|
|
||||||
# use unittest.mock
|
# use unittest.mock
|
||||||
find -type f -name '*.py' -exec sed \
|
find -type f -name '*.py' -exec sed \
|
||||||
-e 's/^\( *\)import mock$/\1from unittest import mock/' \
|
-e 's/^\( *\)import mock$/\1from unittest import mock/' \
|
||||||
@ -64,6 +57,23 @@ find -type f -name '*.py' -exec sed \
|
|||||||
-e 's/^\( *\)from mock import/\1from unittest.mock import/' \
|
-e 's/^\( *\)from mock import/\1from unittest.mock import/' \
|
||||||
-i '{}' +
|
-i '{}' +
|
||||||
|
|
||||||
|
# RHEL does not run coverage tests.
|
||||||
|
# mock is deprecated in RHEL. We use unittest.mock.
|
||||||
|
# pip-tools is not used directly by the unit tests.
|
||||||
|
# pytest-xdist is unwanted in RHEL.
|
||||||
|
sed \
|
||||||
|
-e 's|==.*||' \
|
||||||
|
-e '/coverage/d' \
|
||||||
|
-e '/mock/d' \
|
||||||
|
-e '/pip-tools/d' \
|
||||||
|
-e '/pytest-cov/d' \
|
||||||
|
%{?rhel:-e '/pytest-xdist/d'} \
|
||||||
|
requirements-test.txt > _requirements-test.txt
|
||||||
|
|
||||||
|
|
||||||
|
%generate_buildrequires
|
||||||
|
%pyproject_buildrequires _requirements-test.txt
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%pyproject_wheel
|
%pyproject_wheel
|
||||||
@ -84,32 +94,20 @@ install -Dpm0644 bin/aws_zsh_completer.sh \
|
|||||||
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
|
# it appears that some tests modify the environment and remove PYTHONPATH
|
||||||
|
# so it's not passed to botocore cmd-runner, inject it here
|
||||||
|
sed -i '/self.driver.start(env=env)/i \ \ \ \ \ \ \ \ env["PYTHONPATH"] = "%{buildroot}%{python3_sitelib}"' \
|
||||||
|
tests/utils/botocore/__init__.py
|
||||||
|
|
||||||
|
export TESTS_REMOVE_REPO_ROOT_FROM_PATH=1 TZ=UTC
|
||||||
|
%if 0%{?rhel}
|
||||||
export OPENSSL_ENABLE_SHA1_SIGNATURES=yes
|
export OPENSSL_ENABLE_SHA1_SIGNATURES=yes
|
||||||
|
|
||||||
%pyproject_check_import
|
|
||||||
|
|
||||||
%if %{with tests}
|
|
||||||
# Upstream also treats some warnings, such as DeprecationWarning, as a failure, but the
|
|
||||||
# code has deprecation warnings in it. So, we disable warnings as errors for both
|
|
||||||
# sets of tests below. Also skip tests that depend on colorama.
|
|
||||||
%pytest tests/unit \
|
|
||||||
--disable-pytest-warnings -Wd \
|
|
||||||
-k "not test_non_aggregate_keys and not test_can_use_color" \
|
|
||||||
--ignore tests/unit/output/test_yaml_output.py \
|
|
||||||
--ignore tests/unit/customizations/logs/test_tail.py
|
|
||||||
|
|
||||||
# awscli has some command runners built into tests and some of them eat the environment
|
|
||||||
# variables, especially PYTHONPATH, and cause awscli to fail to import. Also skip tests
|
|
||||||
# that depend on colorama.
|
|
||||||
%pytest tests/functional \
|
|
||||||
--disable-pytest-warnings -Wd \
|
|
||||||
--ignore tests/functional/autocomplete/test_completion_files.py \
|
|
||||||
--ignore tests/functional/botocore/test_waiter_config.py \
|
|
||||||
--ignore tests/functional/botocore/leak/test_resource_leaks.py \
|
|
||||||
--ignore tests/functional/dependencies/test_colorama.py \
|
|
||||||
--ignore tests/functional/logs/test_tail.py \
|
|
||||||
-k "not test_smoke_test_completer and not test_pipe_color"
|
|
||||||
%endif
|
%endif
|
||||||
|
%pytest --verbose %{!?rhel:--numprocesses=auto --dist=loadfile --maxprocesses=4} \
|
||||||
|
--disable-pytest-warnings -Wd \
|
||||||
|
tests/unit tests/functional \
|
||||||
|
--ignore tests/functional/autocomplete/test_completion_files.py \
|
||||||
|
--ignore tests/functional/botocore/test_waiter_config.py
|
||||||
|
|
||||||
|
|
||||||
%files -f %{pyproject_files}
|
%files -f %{pyproject_files}
|
||||||
@ -122,5 +120,9 @@ export OPENSSL_ENABLE_SHA1_SIGNATURES=yes
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu May 09 2024 Major Hayden <major@redhat.com> - 2.15.31-2
|
||||||
|
- Remove colorama patches
|
||||||
|
- Bring in the latest updates from Fedora
|
||||||
|
|
||||||
* Wed Jan 31 2024 Major Hayden <major@redhat.com> - 2.15.31-1
|
* Wed Jan 31 2024 Major Hayden <major@redhat.com> - 2.15.31-1
|
||||||
- Initial RHEL 9 package.
|
- Initial RHEL 9 package.
|
||||||
|
Loading…
Reference in New Issue
Block a user