1. Pypy
  2. Untitled project
  3. compatibility

Wiki

Clone wiki

compatibility / reportlab_toolkit

ReportLab Toolkit

Starting from PyPy nightly build from 28 june 2011 ReportLab is compatible with PyPy. C extensions have to be deleted(files _rl_accel.pypy-15.so, sgmlop.pypy-15.so, pyHnj.pypy-15.so, _renderPM.pypy-15.so from dir site-packages).

If older PyPy version is used(for example 1.5), following patch for reportlab is required:

diff -ur orig/src/reportlab/graphics/barcode/code39.py ./src/reportlab/graphics/barcode/code39.py
--- orig/src/reportlab/graphics/barcode/code39.py	2010-02-08 16:17:33.000000000 -0200
+++ ./src/reportlab/graphics/barcode/code39.py	2011-02-09 07:43:59.000000000 -0200
@@ -198,7 +198,7 @@
                 self.valid = 0
                 continue
             vval(c)
-        self.validated = ''.join(vval.__self__)
+        self.validated = ''.join(vval.__self__ if hasattr(vval, '__self__') else vval.im_self)
         return self.validated

     def encode(self):
diff -ur orig/src/reportlab/graphics/charts/axes.py ./src/reportlab/graphics/charts/axes.py
--- orig/src/reportlab/graphics/charts/axes.py	2010-07-27 06:36:33.000000000 -0300
+++ ./src/reportlab/graphics/charts/axes.py	2011-02-09 07:40:08.000000000 -0200
@@ -303,8 +303,8 @@
                     R(a)
                 else:
                     P(a)
-            D[v] = R.__self__
-            A[:] = P.__self__
+            D[v] = R.__self__ if hasattr(R, '__self__') else R.im_self
+            A[:] = P.__self__ if hasattr(P, '__self__') else P.im_self
         D['late'] += A
         return D

@@ -519,7 +519,7 @@
                         t = x+dCnv((j+1)*dst)
                         if t<=vn or t>=vx: continue
                         T(t)
-                self._subTickValues = T.__self__
+                self._subTickValues = T.__self__  if hasattr(T, '__self__') else T.im_self
         self._tickValues = self._subTickValues
         return otv

diff -ur orig/src/reportlab/graphics/charts/barcharts.py ./src/reportlab/graphics/charts/barcharts.py
--- orig/src/reportlab/graphics/charts/barcharts.py	2010-09-02 11:40:46.000000000 -0300
+++ ./src/reportlab/graphics/charts/barcharts.py	2011-02-09 07:42:51.000000000 -0200
@@ -583,8 +583,8 @@
                         C(self._computeLabelPosition(text, self.barLabels[(rowNo, colNo)], rowNo, colNo, x, y, width, height))
                     else:
                         C(None)
-            R(C.__self__)
-        return R.__self__
+            R(C.__self__ if hasattr(C,' __self__') else C.im_self)
+        return R.__self__ if hasattr(R,'__self__') else R.im_self

     def makeBars(self):
         g = Group()
diff -ur orig/src/reportlab/lib/pygments2xpre.py ./src/reportlab/lib/pygments2xpre.py
--- orig/src/reportlab/lib/pygments2xpre.py	2009-12-17 14:18:34.000000000 -0200
+++ ./src/reportlab/lib/pygments2xpre.py	2011-02-09 07:45:52.000000000 -0200
@@ -57,7 +57,7 @@
         src = open(filename, 'r').read()
         fmt = pygments2xpre(src)
         S(XPreformatted(fmt, style=styC))
-    doc.build(S.__self__)
+    doc.build(S.__self__ if hasattr(S, '__self__') else S.im_self)
     print 'saved pygments2xpre.pdf'

 if __name__=='__main__':
diff -ur orig/src/reportlab/lib/utils.py ./src/reportlab/lib/utils.py
--- orig/src/reportlab/lib/utils.py	2010-09-08 10:23:56.000000000 -0300
+++ ./src/reportlab/lib/utils.py	2011-02-09 07:46:25.000000000 -0200
@@ -911,7 +911,7 @@
                         A('%s=%r' % (vn,getattr(m,vn)))
             except:
                 A('not found')
-            self._writeln(' '+' '.join(A.__self__))
+            self._writeln(' '+' '.join(A.__self__ if hasattr(A, '__self__') else A.im_self))

     specials = {'__module_versions': _show_module_versions,
                 '__payload': _show_payload,
diff -ur orig/src/reportlab/pdfbase/pdfdoc.py ./src/reportlab/pdfbase/pdfdoc.py
--- orig/src/reportlab/pdfbase/pdfdoc.py	2010-09-30 12:52:16.000000000 -0300
+++ ./src/reportlab/pdfbase/pdfdoc.py	2011-02-09 07:38:40.000000000 -0200
@@ -2231,7 +2231,7 @@
                     R(str(v))
                     R('mul')
                 R('exch')
-        return '{%s}' % (' '.join(R.__self__))
+        return '{%s}' % (' '.join(R.__self__ if hasattr(R, '__self__') else R.im_self))

     def value(self):
         return PDFArrayCompact((
diff -ur orig/src/reportlab/pdfbase/pdfutils.py ./src/reportlab/pdfbase/pdfutils.py
--- orig/src/reportlab/pdfbase/pdfutils.py	2010-09-06 12:00:23.000000000 -0300
+++ ./src/reportlab/pdfbase/pdfutils.py	2011-02-09 07:47:29.000000000 -0200
@@ -283,7 +283,7 @@

         #terminator code for ascii 85
         out('~>')
-        return ''.join(out.__self__)
+        return ''.join(out.__self__ if hasattr(out, '__self__') else out.im_self)

     def _AsciiBase85DecodePYTHON(input):
         """Decodes input using ASCII-Base85 coding.
@@ -358,7 +358,7 @@
             out(lastword)

         #terminator code for ascii 85
-        return ''.join(out.__self__)
+        return ''.join(out.__self__ if hasattr(out, '__self__') else out.im_self)

 try:
     from _rl_accel import _AsciiBase85Encode                    # builtin or on the path
diff -ur orig/src/reportlab/pdfgen/canvas.py ./src/reportlab/pdfgen/canvas.py
--- orig/src/reportlab/pdfgen/canvas.py	2010-09-29 16:37:05.000000000 -0300
+++ ./src/reportlab/pdfgen/canvas.py	2011-02-09 07:48:20.000000000 -0200
@@ -339,7 +339,8 @@
             #set an initial font
             if font.face.builtIn or not getattr(self,'_drawTextAsPath',False):
                 P('BT %s 12 Tf 14.4 TL ET' % self._doc.getInternalFontName(self._fontname))
-        self._preamble = ' '.join(P.__self__)
+
+        self._preamble =  ' '.join(P.__self__ if hasattr(P, '__self__') else P.im_self)

     if not _instanceEscapePDF:
         def _escape(self, s):
diff -ur orig/src/reportlab/platypus/flowables.py ./src/reportlab/platypus/flowables.py
--- orig/src/reportlab/platypus/flowables.py	2010-08-06 12:55:36.000000000 -0300
+++ ./src/reportlab/platypus/flowables.py	2011-02-09 07:46:53.000000000 -0200
@@ -777,7 +777,7 @@
         C = [].append
         for c in (content or self._content):
             C(cdeepcopy(c))
-        self._content = C.__self__
+        self._content = C.__self__ if hasattr(C, '__self__') else C.im_self

 class PTOContainer(_Container,Flowable):
     '''PTOContainer(contentList,trailerList,headerList)

URL:http://www.reportlab.com/software/opensource/rl-toolkit/
Category:Document generation
Compatible:Compatible
Hard Dependencies
C-API Compatibility Unknown
Python Imaging Library (PIL) Compatible More Information

Updated