author | robin |
Thu, 24 Oct 2019 16:07:15 +0100 | |
changeset 4551 | d357e2acc856 |
parent 4545 | b117091a73c2 |
child 4555 | 1656a1578930 |
permissions | -rw-r--r-- |
4445
076d2cbce430
try to prevent infinite looping for small paragraph widths; version --> 3.5.1
robin <robin@reportlab.com>
parents:
4433
diff
changeset
|
1 |
#Copyright ReportLab Europe Ltd. 2000-2018 |
494 | 2 |
#see license.txt for license details |
681 | 3 |
__doc__="""The Reportlab PDF generation library.""" |
4551 | 4 |
Version = "3.5.32" |
4194
9ecdf084933c
allow Table.repeatRows to be a list/tuple; version-->3.1.59
robin
parents:
4192
diff
changeset
|
5 |
__version__=Version |
4551 | 6 |
__date__='20191024' |
2618
19c47ce76a0c
changed version and added warning for old Python users
andy
parents:
2407
diff
changeset
|
7 |
|
4260 | 8 |
import sys, os |
2618
19c47ce76a0c
changed version and added warning for old Python users
andy
parents:
2407
diff
changeset
|
9 |
|
4516
99e01611df97
drop support for python3.4; prepare for python3.8; version --> 3.5.24
robin
parents:
4514
diff
changeset
|
10 |
if sys.version_info[0:2]!=(2, 7) and sys.version_info<(3, 5): |
99e01611df97
drop support for python3.4; prepare for python3.8; version --> 3.5.24
robin
parents:
4514
diff
changeset
|
11 |
raise ImportError("""reportlab requires Python 2.7+ or 3.5+; 3.0-3.4 are not supported. |
99e01611df97
drop support for python3.4; prepare for python3.8; version --> 3.5.24
robin
parents:
4514
diff
changeset
|
12 |
If you want to try with other python versions edit line 10 of reportlab/__init__ |
99e01611df97
drop support for python3.4; prepare for python3.8; version --> 3.5.24
robin
parents:
4514
diff
changeset
|
13 |
to remove this error.""") |
3820 | 14 |
|
15 |
#define these early in reportlab's life |
|
16 |
isPy3 = sys.version_info[0]==3 |
|
17 |
if isPy3: |
|
18 |
def cmp(a,b): |
|
19 |
return -1 if a<b else (1 if a>b else 0) |
|
4367
9960d82643bf
remove ascii, cmp & xrange builtins abuse; version-->3.4.15
robin <robin@reportlab.com>
parents:
4363
diff
changeset
|
20 |
xrange = range |
9960d82643bf
remove ascii, cmp & xrange builtins abuse; version-->3.4.15
robin <robin@reportlab.com>
parents:
4363
diff
changeset
|
21 |
ascii = ascii |
3820 | 22 |
|
4260 | 23 |
def _fake_import(fn,name): |
24 |
from importlib import machinery |
|
25 |
m = machinery.SourceFileLoader(name,fn) |
|
26 |
try: |
|
4261 | 27 |
sys.modules[name] = m.load_module(name) |
4260 | 28 |
except FileNotFoundError: |
29 |
raise ImportError('file %s not found' % ascii(fn)) |
|
3820 | 30 |
else: |
31 |
from future_builtins import ascii |
|
4367
9960d82643bf
remove ascii, cmp & xrange builtins abuse; version-->3.4.15
robin <robin@reportlab.com>
parents:
4363
diff
changeset
|
32 |
xrange = xrange |
9960d82643bf
remove ascii, cmp & xrange builtins abuse; version-->3.4.15
robin <robin@reportlab.com>
parents:
4363
diff
changeset
|
33 |
cmp = cmp |
4260 | 34 |
def _fake_import(fn,name): |
35 |
if os.path.isfile(fn): |
|
36 |
import imp |
|
37 |
with open(fn,'rb') as f: |
|
4261 | 38 |
sys.modules[name] = imp.load_source(name,fn,f) |
4032
5106a9463326
__init__.py: attempt import of reportlab.local_rl_mods for customization
robin
parents:
4031
diff
changeset
|
39 |
|
4050
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
40 |
#try to use dynamic modifications from |
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
41 |
#reportlab.local_rl_mods.py |
4053 | 42 |
#reportlab_mods.py or ~/.reportlab_mods |
4032
5106a9463326
__init__.py: attempt import of reportlab.local_rl_mods for customization
robin
parents:
4031
diff
changeset
|
43 |
try: |
5106a9463326
__init__.py: attempt import of reportlab.local_rl_mods for customization
robin
parents:
4031
diff
changeset
|
44 |
import reportlab.local_rl_mods |
5106a9463326
__init__.py: attempt import of reportlab.local_rl_mods for customization
robin
parents:
4031
diff
changeset
|
45 |
except ImportError: |
5106a9463326
__init__.py: attempt import of reportlab.local_rl_mods for customization
robin
parents:
4031
diff
changeset
|
46 |
pass |
4050
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
47 |
|
4363
fa1c8635929e
attempted fix for bitbucket #issue 114 reported by Martin Groen; version-->3.4.14
robin <robin@reportlab.com>
parents:
4362
diff
changeset
|
48 |
if not isPy3: |
fa1c8635929e
attempted fix for bitbucket #issue 114 reported by Martin Groen; version-->3.4.14
robin <robin@reportlab.com>
parents:
4362
diff
changeset
|
49 |
PermissionError = ImportError |
fa1c8635929e
attempted fix for bitbucket #issue 114 reported by Martin Groen; version-->3.4.14
robin <robin@reportlab.com>
parents:
4362
diff
changeset
|
50 |
|
4050
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
51 |
try: |
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
52 |
import reportlab_mods #application specific modifications can be anywhere on python path |
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
53 |
except ImportError: |
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
54 |
try: |
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
55 |
_fake_import(os.path.expanduser(os.path.join('~','.reportlab_mods')),'reportlab_mods') |
4363
fa1c8635929e
attempted fix for bitbucket #issue 114 reported by Martin Groen; version-->3.4.14
robin <robin@reportlab.com>
parents:
4362
diff
changeset
|
56 |
except (ImportError,KeyError,PermissionError): |
4050
a899d3baa5f4
__init__.py, rl_config.py & rl_settings.py: revamp initialization yet again
robin
parents:
4047
diff
changeset
|
57 |
pass |