[impressive] backport PDF parser fix
mjg
mjg at fedoraproject.org
Mon Nov 28 13:23:36 UTC 2011
commit 8d0329fffa1a5e1e5b09d3026155f7ce9fa5bc75
Author: Michael J Gruber <mjg at fedoraproject.org>
Date: Mon Nov 28 14:22:35 2011 +0100
backport PDF parser fix
https://bugzilla.redhat.com/show_bug.cgi?id=752511
impressive-0.10.3-parser-fix.patch | 63 ++++++++++++++++++++++++++++++++++++
impressive.spec | 9 ++++-
2 files changed, 70 insertions(+), 2 deletions(-)
---
diff --git a/impressive-0.10.3-parser-fix.patch b/impressive-0.10.3-parser-fix.patch
new file mode 100644
index 0000000..5a5f176
--- /dev/null
+++ b/impressive-0.10.3-parser-fix.patch
@@ -0,0 +1,63 @@
+--- Impressive-0.10.3/impressive.py 2011-11-28 14:08:14.000000000 +0100
++++ Impressive-0.10.4-WIP/impressive.py 2011-11-28 14:03:46.000000000 +0100
+@@ -511,7 +511,7 @@
+ try:
+ return func(*args, **kwargs)
+ except:
+- print >>sys.stderr, "----- Exception in user function ----"
++ print >>sys.stderr, "----- Unhandled Exception ----"
+ traceback.print_exc(file=sys.stderr)
+ print >>sys.stderr, "----- End of traceback -----"
+
+@@ -1296,7 +1296,7 @@
+ return self.parse_tokens(filter(None, data.split()))
+
+ def getobj(self, obj, force_type=None):
+- if obj.__class__ == PDFref:
++ if isinstance(obj, PDFref):
+ obj = obj.ref
+ if type(obj) != types.IntType:
+ raise PDFError, "object is not a valid reference"
+@@ -1432,11 +1432,14 @@
+ if 'Dest' in node:
+ dest = self.dest2page(node['Dest'])
+ elif 'A' in node:
+- action = node['A']['S']
++ a = node['A']
++ if isinstance(a, PDFref):
++ a = self.getobj(a)
++ action = a['S']
+ if action == 'URI':
+- dest = node['A'].get('URI', None)
++ dest = a.get('URI', None)
+ elif action == 'GoTo':
+- dest = self.dest2page(node['A'].get('D', None))
++ dest = self.dest2page(a.get('D', None))
+ if dest:
+ return tuple(node['Rect'] + [dest])
+ except PDFError:
+@@ -2013,13 +2018,13 @@
+ for pdf in FileProps:
+ if not pdf.lower().endswith(".pdf"): continue
+ if RTrestart: break
+- ParsePDF(pdf)
++ SafeCall(ParsePDF, [pdf])
+ if RTrestart: continue
+ for page in xrange(1, PageCount + 1):
+ if RTrestart: break
+ if (page != p1) and (page != p2) \
+ and (page >= PageRangeStart) and (page <= PageRangeEnd):
+- PageImage(page)
++ SafeCall(PageImage, [page])
+ RTrunning = False
+ if CacheMode >= FileCache:
+ print >>sys.stderr, "Background rendering finished, used %.1f MiB of disk space." %\
+@@ -3821,7 +3826,7 @@
+ if not CacheMode:
+ for pdf in FileProps:
+ if pdf.lower().endswith(".pdf"):
+- ParsePDF(pdf)
++ SafeCall(ParsePDF, [pdf])
+
+ # start output and enter main loop
+ StartTime = pygame.time.get_ticks()
diff --git a/impressive.spec b/impressive.spec
index 2f500f1..a4e02d3 100644
--- a/impressive.spec
+++ b/impressive.spec
@@ -1,6 +1,6 @@
Name: impressive
Version: 0.10.3
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: A program that displays presentation slides
Group: Applications/Productivity
@@ -9,6 +9,8 @@ URL: http://impressive.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/Impressive-%{version}.tar.gz
# Wrapper script for making sure hardware acceleration is available
Source1: %{name}.sh
+# backport PDF parser fix
+Patch0: impressive-0.10.3-parser-fix.patch
BuildArch: noarch
BuildRequires: python-devel
@@ -41,7 +43,7 @@ that are really useful for presentations.
%prep
%setup -q -n Impressive-%{version}
-
+%patch0 -p1 -b .parser-fix
%build
sed -e "s|@PYTHON_SITELIB@|%{python_sitelib}|" %{SOURCE1} > impressive.sh
@@ -67,6 +69,9 @@ rm -rf %{buildroot}
%{_mandir}/man1/impressive.1*
%changelog
+* Mon Nov 28 2011 Michael J Gruber <mjg at fedoraproject.org> - 0.10.3-7
+- backport PDF parser fix
+
* Mon May 02 2011 Michael J Gruber <mjg at fedoraproject.org> - 0.10.3-6
- EPEL has no pdftk (recommended but optional requirement)
More information about the scm-commits
mailing list