diff options
author | Christopher | 2022-02-18 22:01:28 -0500 |
---|---|---|
committer | Christopher | 2022-02-18 22:01:28 -0500 |
commit | cc438efd3828b62777ce73330249b33d01fab433 (patch) | |
tree | ea6f86f88be0ed7c2cbd859ce10976d908b6f22e | |
parent | df7d939c2e057628e9c5844069534c88eebea3d3 (diff) | |
download | aur-cc438efd3828b62777ce73330249b33d01fab433.tar.gz |
The python3 patch broke pdf.py, but it is fixed now.
Because python 3 dicts are ordered, pdf.py output is shuffled
relative to the python 2 version, but file sizes should be the same.
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 4 | ||||
-rw-r--r-- | jbig2enc-pdfpy.patch | 141 |
3 files changed, 139 insertions, 8 deletions
@@ -21,7 +21,7 @@ pkgbase = jbig2enc source = jbig2enc-pdfpy.patch source = jbig2enc.1 sha256sums = bfcf0d0448ee36046af6c776c7271cd5a644855723f0a832d1c0db4de3c21280 - sha256sums = 2614e02f9cc71d9b186ffaecf6abb4b270ad9ce43cb4d6284e9e96c4e4a44d06 + sha256sums = a5d98fc43b2f3dc73dd1f352a439a6ae73fd085f469420aa29e47d9a4e2f40f6 sha256sums = c940124f102695872fae02b243e0dd99c05ecfb3ecef0a476b3e903a0db69a54 pkgname = jbig2enc @@ -4,7 +4,7 @@ pkgname=jbig2enc pkgver=0.29 -pkgrel=2 +pkgrel=3 pkgdesc="A JBIG2 image encoder" arch=('i686' 'x86_64') url="https://github.com/agl/jbig2enc" @@ -18,7 +18,7 @@ source=("https://github.com/agl/jbig2enc/archive/refs/tags/$pkgver.tar.gz" "jbig2enc-pdfpy.patch" "jbig2enc.1") sha256sums=('bfcf0d0448ee36046af6c776c7271cd5a644855723f0a832d1c0db4de3c21280' - '2614e02f9cc71d9b186ffaecf6abb4b270ad9ce43cb4d6284e9e96c4e4a44d06' + 'a5d98fc43b2f3dc73dd1f352a439a6ae73fd085f469420aa29e47d9a4e2f40f6' 'c940124f102695872fae02b243e0dd99c05ecfb3ecef0a476b3e903a0db69a54') diff --git a/jbig2enc-pdfpy.patch b/jbig2enc-pdfpy.patch index 76f084dac9cc..a58cd07ef526 100644 --- a/jbig2enc-pdfpy.patch +++ b/jbig2enc-pdfpy.patch @@ -1,12 +1,143 @@ -diff --unified --recursive --text jbig2enc-0.29.orig/pdf.py jbig2enc-0.29.new/pdf.py ---- jbig2enc-0.29.orig/pdf.py 2017-01-30 12:27:36.000000000 -0500 -+++ jbig2enc-0.29.new/pdf.py 2022-02-18 17:35:32.486793465 -0500 -@@ -162,7 +162,7 @@ +diff --unified --recursive --text --color jbig2enc-0.29/pdf.py jbig2enc-0.29.new/pdf.py +--- jbig2enc-0.29/pdf.py 2017-01-30 12:27:36.000000000 -0500 ++++ jbig2enc-0.29.new/pdf.py 2022-02-18 21:55:20.043706067 -0500 +@@ -33,23 +33,24 @@ + class Ref: + def __init__(self, x): + self.x = x +- def __str__(self): +- return "%d 0 R" % self.x ++ ++ def __bytes__(self): ++ return b"%d 0 R" % self.x + + class Dict: + def __init__(self, values = {}): + self.d = {} + self.d.update(values) + +- def __str__(self): +- s = ['<< '] ++ def __bytes__(self): ++ s = [b'<< '] + for (x, y) in self.d.items(): +- s.append('/%s ' % x) +- s.append(str(y)) +- s.append("\n") +- s.append(">>\n") ++ s.append(b"/%s " % x.encode()) ++ s.append(y.encode()) ++ s.append(b"\n") ++ s.append(b">>\n") + +- return ''.join(s) ++ return b''.join(s) + + global_next_id = 1 + +@@ -65,16 +66,18 @@ + self.id = global_next_id + global_next_id += 1 + +- def __str__(self): ++ def __bytes__(self): + s = [] +- s.append(str(self.d)) ++ s.append(bytes(self.d)) + if self.stream is not None: +- s.append('stream\n') +- s.append(self.stream) +- s.append('\nendstream\n') +- s.append('endobj\n') +- +- return ''.join(s) ++ s.append(b'stream\n') ++ if isinstance(self.stream, str): ++ s.append(self.stream.encode()) ++ else: ++ s.append(self.stream) ++ s.append(b'\nendstream\n') ++ s.append(b'endobj\n') ++ return b''.join(s) + + class Doc: + def __init__(self): +@@ -89,7 +92,7 @@ + self.pages.append(o) + return self.add_object(o) + +- def __str__(self): ++ def __bytes__(self): + a = [] + j = [0] + offsets = [] +@@ -97,27 +100,27 @@ + def add(x): + a.append(x) + j[0] += len(x) + 1 +- add('%PDF-1.4') ++ add(b'%PDF-1.4') + for o in self.objs: + offsets.append(j[0]) +- add('%d 0 obj' % o.id) +- add(str(o)) ++ add(b'%d 0 obj' % o.id) ++ add(bytes(o)) + xrefstart = j[0] +- a.append('xref') +- a.append('0 %d' % (len(offsets) + 1)) +- a.append('0000000000 65535 f ') ++ a.append(b'xref') ++ a.append(b'0 %d' % (len(offsets) + 1)) ++ a.append(b'0000000000 65535 f ') + for o in offsets: +- a.append('%010d 00000 n ' % o) +- a.append('') +- a.append('trailer') +- a.append('<< /Size %d\n/Root 1 0 R >>' % (len(offsets) + 1)) +- a.append('startxref') +- a.append(str(xrefstart)) +- a.append('%%EOF') ++ a.append(b'%010d 00000 n ' % o) ++ a.append(b'') ++ a.append(b'trailer') ++ a.append(b'<< /Size %d\n/Root 1 0 R >>' % (len(offsets) + 1)) ++ a.append(b'startxref') ++ a.append(b'%d' % xrefstart) ++ a.append(b'%%EOF') + + # sys.stderr.write(str(offsets) + "\n") + +- return '\n'.join(a) ++ return b'\n'.join(a) + + def ref(x): + return '%d 0 R' % x +@@ -128,13 +131,15 @@ + doc.add_object(Obj({'Type' : '/Outlines', 'Count': '0'})) + pages = Obj({'Type' : '/Pages'}) + doc.add_object(pages) +- symd = doc.add_object(Obj({}, file(symboltable, 'rb').read())) ++ with open(symboltable, 'rb') as f: ++ symd = doc.add_object(Obj({}, f.read())) + page_objs = [] + + pagefiles.sort() + for p in pagefiles: + try: +- contents = file(p, mode='rb').read() ++ with open(p, 'rb') as f: ++ contents = f.read() + except IOError: + sys.stderr.write("error reading page file %s\n"% p) + continue +@@ -162,7 +167,8 @@ pages.d.d['Count'] = str(len(page_objs)) pages.d.d['Kids'] = '[' + ' '.join([ref(x.id) for x in page_objs]) + ']' - print str(doc) -+ print(str(doc)) ++ sys.stdout.buffer.write(bytes(doc)) ++ sys.stdout.buffer.write(b'\n') def usage(script, msg): |