Merged update from upstream sources
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/pcs.git#f00a25ef213e51f9e66b2934995050b913a44865
This commit is contained in:
parent
90dd73d5c0
commit
60f139c3bb
52
fix-getting-type-hints-annotations-in-python-3.10.patch
Normal file
52
fix-getting-type-hints-annotations-in-python-3.10.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From 9f7c50b9bfaafd5d8368eeb34014e65655318ac0 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Mular <omular@redhat.com>
|
||||
Date: Wed, 25 Nov 2020 10:16:26 +0100
|
||||
Subject: [PATCH] fix getting type hints annotations in python 3.10
|
||||
|
||||
In Python 3.10 a postponed evaluation of type hint annotations [1] will
|
||||
be a default [2]. To access annotated types as objects instead of
|
||||
strings, we need to use function `typing.get_type_hints(...)`
|
||||
|
||||
[1]: https://www.python.org/dev/peps/pep-0563/
|
||||
[2]: https://docs.python.org/3.10/whatsnew/3.10.html#pep-563-postponed-evaluation-of-annotations-becomes-default
|
||||
---
|
||||
pcs/cli/reports/messages.py | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/pcs/cli/reports/messages.py b/pcs/cli/reports/messages.py
|
||||
index ecf74561..7582aec0 100644
|
||||
--- a/pcs/cli/reports/messages.py
|
||||
+++ b/pcs/cli/reports/messages.py
|
||||
@@ -1,4 +1,5 @@
|
||||
from typing import (
|
||||
+ get_type_hints,
|
||||
Any,
|
||||
Dict,
|
||||
Mapping,
|
||||
@@ -44,7 +45,7 @@ class CliReportMessageCustom(CliReportMessage):
|
||||
|
||||
def __init__(self, dto_obj: dto.ReportItemMessageDto) -> None:
|
||||
super().__init__(dto_obj)
|
||||
- self._obj = self.__class__.__annotations__.get("_obj")( # type: ignore
|
||||
+ self._obj = get_type_hints(self.__class__).get("_obj")( # type: ignore
|
||||
**dto_obj.payload
|
||||
)
|
||||
|
||||
@@ -446,9 +447,11 @@ def _create_report_msg_map() -> Dict[str, type]:
|
||||
result: Dict[str, type] = {}
|
||||
for report_msg_cls in get_all_subclasses(CliReportMessageCustom):
|
||||
# pylint: disable=protected-access
|
||||
- code = report_msg_cls.__annotations__.get(
|
||||
- "_obj", item.ReportItemMessage
|
||||
- )._code
|
||||
+ code = (
|
||||
+ get_type_hints(report_msg_cls)
|
||||
+ .get("_obj", item.ReportItemMessage)
|
||||
+ ._code
|
||||
+ )
|
||||
if code:
|
||||
if code in result:
|
||||
raise AssertionError()
|
||||
--
|
||||
2.27.0
|
||||
|
9
pcs.spec
9
pcs.spec
@ -1,6 +1,6 @@
|
||||
Name: pcs
|
||||
Version: 0.10.7
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
|
||||
# GPLv2: pcs
|
||||
# MIT: ember, handlebars, jquery, jquery-ui
|
||||
@ -47,7 +47,7 @@ Source44: https://github.com/konradhalas/dacite/archive/v%{dacite_version}/dacit
|
||||
Source100: https://github.com/idevat/pcs-web-ui/archive/%{ui_commit}/%{ui_src_name}.tar.gz
|
||||
Source101: https://github.com/idevat/pcs-web-ui/releases/download/%{ui_commit}/pcs-web-ui-node-modules-%{ui_commit}.tar.xz
|
||||
|
||||
# Patch0: name.patch
|
||||
Patch0: fix-getting-type-hints-annotations-in-python-3.10.patch
|
||||
|
||||
# git for patches
|
||||
BuildRequires: git
|
||||
@ -207,7 +207,7 @@ update_times_patch(){
|
||||
update_times ${patch_file_name} `diffstat -p1 -l ${patch_file_name}`
|
||||
}
|
||||
|
||||
# update_times_patch %%{PATCH0}
|
||||
update_times_patch %{PATCH0}
|
||||
|
||||
# prepare dirs/files necessary for building web ui
|
||||
# inside SOURCE100 is only directory %%{ui_src_name}
|
||||
@ -394,6 +394,9 @@ remove_all_tests
|
||||
%license pyagentx_LICENSE.txt
|
||||
|
||||
%changelog
|
||||
* Thu Nov 26 2020 Ondrej Mular <omular@redhat.com> - 0.10.7-2
|
||||
- Python 3.10 related fix
|
||||
|
||||
* Wed Sep 30 2020 Miroslav Lisik <mlisik@redhat.com> - 0.10.7-1
|
||||
- Rebased to latest upstream sources (see CHANGELOG.md)
|
||||
- Added dependency on python packages pyparsing and dateutil
|
||||
|
Loading…
Reference in New Issue
Block a user