author robin
Thu, 24 Oct 2019 16:07:15 +0100
changeset 4551 d357e2acc856
parent 4545 b117091a73c2
child 4555 1656a1578930
permissions -rw-r--r--
improve usage of eval/exec; version --> 3.5.32

#Copyright ReportLab Europe Ltd. 2000-2018
#see license.txt for license details
__doc__="""The Reportlab PDF generation library."""
Version = "3.5.32"

import sys, os

if sys.version_info[0:2]!=(2, 7) and sys.version_info<(3, 5):
    raise ImportError("""reportlab requires Python 2.7+ or 3.5+; 3.0-3.4 are not supported.
If you want to try with other python versions edit line 10 of reportlab/__init__
to remove this error.""")

#define these early in reportlab's life
isPy3 = sys.version_info[0]==3
if isPy3:
    def cmp(a,b):
        return -1 if a<b else (1 if a>b else 0)
    xrange = range
    ascii = ascii

    def _fake_import(fn,name):
        from importlib import machinery
        m = machinery.SourceFileLoader(name,fn)
            sys.modules[name] = m.load_module(name)
        except FileNotFoundError:
            raise ImportError('file %s not found' % ascii(fn))
    from future_builtins import ascii
    xrange = xrange
    cmp = cmp
    def _fake_import(fn,name):
        if os.path.isfile(fn):
            import imp
            with open(fn,'rb') as f:
                sys.modules[name] = imp.load_source(name,fn,f)

#try to use dynamic modifications from or ~/.reportlab_mods
    import reportlab.local_rl_mods
except ImportError:

if not isPy3:
    PermissionError = ImportError

    import reportlab_mods   #application specific modifications can be anywhere on python path
except ImportError:
    except (ImportError,KeyError,PermissionError):