import python-reportlab-3.4.0-6.el8_1.2

This commit is contained in:
CentOS Sources 2020-01-22 07:28:18 -05:00 committed by Andrew Lukoshko
parent 897ae0f3f9
commit e41dbb29ba
2 changed files with 74 additions and 2 deletions

View File

@ -0,0 +1,60 @@
--- python3-python-reportlab-3.4.0-6.el8/src/reportlab/lib/colors.py
+++ python3-python-reportlab-3.4.0-6.el8/src/reportlab/lib/colors.py
@@ -835,6 +835,44 @@ class cssParse:
cssParse=cssParse()
+def parseColorClassFromString(arg):
+ splitted = "".join(arg.split()).replace('(', ',').replace(')','').split(',')
+ fingerprint = ''.join(c for c in arg if c in set('(,)'))
+ if (len(splitted) > 0):
+ if (splitted[0] == 'Color'):
+ if (fingerprint == '(,,,)'):
+ try:
+ return Color(*list(map(float, splitted[1:5])))
+ except:
+ return None
+ elif (fingerprint == '(,,)'):
+ try:
+ return Color(*list(map(float, splitted[1:4])))
+ except:
+ return None
+ elif (splitted[0] == 'CMYKColor' and fingerprint == '(,,,)'):
+ try:
+ return CMYKColor(*list(map(float, splitted[1:5])))
+ except:
+ return None
+ elif (splitted[0] == 'PCMYKColor' and fingerprint == '(,,,)'):
+ try:
+ return PCMYKColor(*list(map(float, splitted[1:5])))
+ except:
+ return None
+ elif (splitted[0] == 'CMYKColorSep' and fingerprint == '(,,,)'):
+ try:
+ return CMYKColorSep(*list(map(float, splitted[1:5])))
+ except:
+ return None
+ elif (splitted[0] == 'PCMYKColorSep' and fingerprint == '(,,,)'):
+ try:
+ return PCMYKColorSep(*list(map(float, splitted[1:5])))
+ except:
+ return None
+ else:
+ return None
+
class toColor:
def __init__(self):
@@ -860,10 +898,8 @@ class toColor:
C = getAllNamedColors()
s = arg.lower()
if s in C: return C[s]
- try:
- return toColor(eval(arg))
- except:
- pass
+ parsedColor = parseColorClassFromString(arg)
+ if (parsedColor): return parsedColor
try:
return HexColor(arg)

View File

@ -3,12 +3,15 @@
Name: python-%{pypi}
Version: 3.4.0
Release: 6%{?dist}
Release: 6%{?dist}.2
Summary: Library for generating PDFs and graphics
License: BSD
URL: http://www.reportlab.org/
Source0: https://pypi.python.org/packages/source/r/%{pypi}/%{pypi}-%{version}.tar.gz
# https://bugzilla.redhat.com/show_bug.cgi?id=1769661
Patch0: python-reportlab-3.4.0-color-eval.patch
%package -n python3-%{pypi}
Summary: Library for generating PDFs and graphics
BuildRequires: python3-devel
@ -31,7 +34,7 @@ formats.
%package doc
Summary: Documentation for %{name}
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
Requires: python3-%{pypi} = %{version}-%{release}
Obsoletes: %{name}-docs < %{version}-%{release}
%description doc
@ -39,6 +42,7 @@ Contains the documentation for ReportLab.
%prep
%setup -qn reportlab-%{version}
%patch0 -p1 -b .color-eval
# clean up hashbangs from libraries
find src -name '*.py' | xargs sed -i -e '/^#!\//d'
# patch the CMap path by adding Fedora ghostscript path before the match
@ -74,6 +78,14 @@ rm -rf %{buildroot}%{python3_sitearch}/reportlab/fonts
#%doc docs/*.pdf
%changelog
* Wed Jan 15 2020 Marek Kasik <mkasik@redhat.com> - 3.4.0-6.el8_1_0.2
- Fix Requires for doc subpackage
- Resolves: #1788556
* Tue Jan 14 2020 Marek Kasik <mkasik@redhat.com> - 3.4.0-6.el8_1_0.1
- Do not eval strings passed to toColor
- Resolves: #1788555
* Thu May 31 2018 Marek Kasik <mkasik@redhat.com> - 3.4.0-6
- Remove python2-reportlab subpackage
- Resolves: #1567162