Skip to content

Commit

Permalink
[FIX] P3: replace PyPDF by PyPDF2
Browse files Browse the repository at this point in the history
PyPDF is unmaintained and abandoned (as noted on its home page
http://pybrary.net/pyPdf/) and was never updated to Python 3. PyPDF2 is
a fork which provides a mostly compatible API and is P3-compatible.

Replace PyPDF by PyPDF2.
  • Loading branch information
xmo-odoo authored May 12, 2017
1 parent 13ee559 commit 021de21
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions addons/document/models/ir_attachment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import pyPdf
import PyPDF2
import xml.dom.minidom
import zipfile

Expand Down Expand Up @@ -110,7 +110,7 @@ def _index_pdf(self, bin_data):
if bin_data.startswith('%PDF-'):
f = StringIO(bin_data)
try:
pdf = pyPdf.PdfFileReader(f)
pdf = PyPDF2.PdfFileReader(f, overwriteWarnings=False)
for page in pdf.pages:
buf += page.extractText()
except Exception:
Expand Down
4 changes: 2 additions & 2 deletions odoo/addons/base/ir/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from collections import namedtuple
from contextlib import closing
from pyPdf import PdfFileWriter, PdfFileReader
from PyPDF2 import PdfFileWriter, PdfFileReader
from distutils.version import LooseVersion
from reportlab.graphics.barcode import createBarcodeDrawing

Expand Down Expand Up @@ -84,7 +84,7 @@ def _merge_pdf(documents):
for document in documents:
pdfreport = open(document, 'rb')
streams.append(pdfreport)
reader = PdfFileReader(pdfreport)
reader = PdfFileReader(pdfreport, overwriteWarnings=False)
for page in range(0, reader.getNumPages()):
writer.addPage(reader.getPage(page))

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ psycopg2==2.6.2
pydot==1.2.3
pyldap==2.4.28
pyparsing==2.1.10
pyPdf==1.13
PyPDF2==1.26.0
pyserial==3.1.1
python-dateutil==2.5.3
python-openid==2.2.5
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def py2exe_options():
'pychart',
'pydot',
'pyparsing',
'pyPdf',
'PyPDF2',
'pytz',
'reportlab',
'requests',
Expand Down Expand Up @@ -153,7 +153,7 @@ def py2exe_options():
'pydot',
'pyldap', # optional
'pyparsing',
'pypdf',
'pypdf2',
'pyserial',
'python-dateutil',
'python-openid',
Expand Down

0 comments on commit 021de21

Please sign in to comment.