Commit 787bc9f2 authored by Gabriel Monnerat's avatar Gabriel Monnerat

slapos: patch PyPDF2

PyPDF2 must not overwrite showwarning because it breaks ERP5. ERP5 already overwrites it properly

https://github.com/mstamy2/PyPDF2/issues/67#issuecomment-34387142
parent b0b86ec8
From f8ef2a193edf565d61aa628232f0e46e55a6aa6f Mon Sep 17 00:00:00 2001
From: Pavel Brych <pavel@brych.cz>
Date: Thu, 3 Sep 2015 08:04:53 +0200
Subject: [PATCH] Custom implementation of warnings.formatwarning removed
---
PyPDF2/pdf.py | 15 ++-------------
PyPDF2/utils.py | 6 ------
2 files changed, 2 insertions(+), 19 deletions(-)
diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py
index f54680a..3554f40 100644
--- a/PyPDF2/pdf.py
+++ b/PyPDF2/pdf.py
@@ -63,7 +63,7 @@ import warnings
import codecs
from .generic import *
from .utils import readNonWhitespace, readUntilWhitespace, ConvertFunctionsToVirtualList
-from .utils import isString, b_, u_, ord_, chr_, str_, formatWarning
+from .utils import isString, b_, u_, ord_, chr_, str_
if version_info < ( 2, 4 ):
from sets import ImmutableSet as frozenset
@@ -1039,18 +1039,7 @@ class PdfFileReader(object):
``warnings.py`` module with a custom implementation (defaults to
``True``).
"""
- def __init__(self, stream, strict=True, warndest = None, overwriteWarnings = True):
- if overwriteWarnings:
- # have to dynamically override the default showwarning since there are no
- # public methods that specify the 'file' parameter
- def _showwarning(message, category, filename, lineno, file=warndest, line=None):
- if file is None:
- file = sys.stderr
- try:
- file.write(formatWarning(message, category, filename, lineno, line))
- except IOError:
- pass
- warnings.showwarning = _showwarning
+ def __init__(self, stream, strict=True):
self.strict = strict
self.flattenedPages = None
self.resolvedObjects = {}
diff --git a/PyPDF2/utils.py b/PyPDF2/utils.py
index 718a875..7bcb9ce 100644
--- a/PyPDF2/utils.py
+++ b/PyPDF2/utils.py
@@ -64,12 +64,6 @@ def isBytes(b):
return isinstance(b, bytes_type)
-#custom implementation of warnings.formatwarning
-def formatWarning(message, category, filename, lineno, line=None):
- file = filename.replace("/", "\\").rsplit("\\", 1)[1] # find the file name
- return "%s: %s [%s:%s]\n" % (category.__name__, message, file, lineno)
-
-
def readUntilWhitespace(stream, maxchars=None):
"""
Reads non-whitespace characters and returns them.
--
2.23.0
......@@ -198,6 +198,11 @@ scripts =
interpreter=
python_for_test
# patches for eggs
patch-binary = ${patch:location}/bin/patch
PyPDF2-patches = ${:_profile_base_location_}/../../component/egg-patch/PyPDF2/0001-Custom-implementation-of-warnings.formatwarning-remo.patch#d25bb0f5dde7f3337a0a50c2f986f5c8
PyPDF2-patch-options = -p1
[git-clone-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
......@@ -265,6 +270,9 @@ requests-toolbelt = 0.8.0
selenium = 3.141.0
slapos.recipe.template = 4.4
# Patched eggs
PyPDF2 = 1.26.0+SlapOSPatched001
# modern versions for SSL fixed support
requests = 2.20.0
certifi = 2018.10.15
......@@ -291,7 +299,6 @@ backports.lzma = 0.0.13
mock = 2.0.0
testfixtures = 6.11
funcsigs = 1.0.2
PyPDF2 = 1.26.0
mysqlclient = 1.3.12
pexpect = 4.8.0
ptyprocess = 0.6.0
......@@ -410,7 +410,7 @@ eggs = ${neoppod:eggs}
paramiko
ply
pyflakes
pypdf2
PyPDF2
python-magic
python-memcached
pytz
......@@ -528,6 +528,8 @@ extra-paths =
# patches for eggs
patch-binary = ${patch:location}/bin/patch
PyPDF2-patches = ${:_profile_base_location_}/../../component/egg-patch/PyPDF2/0001-Custom-implementation-of-warnings.formatwarning-remo.patch#d25bb0f5dde7f3337a0a50c2f986f5c8
PyPDF2-patch-options = -p1
Acquisition-patches = ${:_profile_base_location_}/../../component/egg-patch/Acquisition/aq_dynamic.patch#1d9a56e9af4371f5b6951ebf217a15d7
Acquisition-patch-options = -p1
Products.DCWorkflow-patches = ${:_profile_base_location_}/../../component/egg-patch/Products.DCWorkflow/workflow_method.patch#975b49e96bae33ac8563454fe5fa9899
......@@ -576,6 +578,7 @@ ocropy = 1.0+SlapOSPatched001
pysvn = 1.7.10+SlapOSPatched002
python-ldap = 2.4.32+SlapOSPatched001
python-magic = 0.4.12+SlapOSPatched001
PyPDF2 = 1.26.0+SlapOSPatched001
## https://lab.nexedi.com/nexedi/slapos/merge_requests/648
pylint = 1.4.4
......@@ -623,7 +626,6 @@ Products.MimetypesRegistry = 2.0.10
Products.PluginRegistry = 1.4
Products.TIDStorage = 5.5.0
pyPdf = 1.13
PyPDF2 = 1.26.0
PyStemmer = 1.3.0
PyXML = 0.8.5
Pympler = 0.4.3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment