update update.sh

This commit is contained in:
j 2016-02-23 11:36:40 +05:30
parent 6ab699c9c8
commit d4d3d82be3
2 changed files with 60 additions and 9 deletions

43
Shared/large_pdf.patch Normal file
View file

@ -0,0 +1,43 @@
diff --git a/Shared/lib/python3.4/site-packages/PyPDF2/pdf.py b/Shared/lib/python3.4/site-packages/PyPDF2/pdf.py
index 1987ccd..5522e4b 100644
--- a/Shared/lib/python3.4/site-packages/PyPDF2/pdf.py
+++ b/Shared/lib/python3.4/site-packages/PyPDF2/pdf.py
@@ -1925,21 +1910,26 @@ class PdfFileReader(object):
if debug: print((" x:", x, "%x"%ord(x)))
if stream.tell() < 2:
raise utils.PdfReadError("EOL marker not found")
- step = min(stream.tell()-2, 8*1024)
- stream.seek(-step, 1)
- x = stream.read(step)
- if b_('\n') in x or b_('\r') in x:
- eol = max(x.rfind(b_('\n')), x.rfind(b_('\r')))
- while eol+1 < len(x) and x[eol+1] in (b_('\n'), b_('\r')):
- eol += 1
- line = x[eol+1:] + line
- while x[eol:eol+1] in (b_('\n'), b_('\r')):
- eol -= 1
- stream.seek(-step+eol, 1)
+ stream.seek(-2, 1)
+ if x == b_('\n') or x == b_('\r'): ## \n = LF; \r = CR
+ crlf = False
+ while x == b_('\n') or x == b_('\r'):
+ if debug:
+ if ord(x) == 0x0D: print(" x is CR 0D")
+ elif ord(x) == 0x0A: print(" x is LF 0A")
+ x = stream.read(1)
+ if x == b_('\n') or x == b_('\r'): # account for CR+LF
+ stream.seek(-1, 1)
+ crlf = True
+ if stream.tell() < 2:
+ raise utils.PdfReadError("EOL marker not found")
+ stream.seek(-2, 1)
+ stream.seek(2 if crlf else 1, 1) #if using CR+LF, go back 2 bytes, else 1
break
else:
+ if debug: print(" x is neither")
line = x + line
- stream.seek(-step, 1)
+ if debug: print((" RNEL line:", line))
if debug: print("leaving RNEL")
return line

View file

@ -1,10 +1,18 @@
HOME=`pwd`/home
mkdir $HOME
export PIP_DOWNLOAD_CACHE=$HOME/../../pip_cache
pip3 install -r ../../openmedialibrary/requirements-shared.txt -I --user
#!/bin/bash
set -e
cd `dirname $0`
export PIP_DOWNLOAD_CACHE=`pwd`/../../pip_cache
mkdir old
mv lib bin old
mv home/.local/lib lib
mv home/.local/bin bin
rm ./lib/python3.4/site-packages/tornado/speedups.cpython-34m.so
rm -r home old
test -e lib && mv lib old/
test -e bin && mv bin old/
rm -rf p34
virtualenv -p /usr/bin/python3.4 p34
p34/bin/pip3 install -r ../../openmedialibrary/requirements-shared.txt
mkdir -p lib/python3.4
mv p34/lib/python3.4/site-packages lib/python3.4/site-packages
patch -p2 -R < large_pdf.patch
rm -r p34 old