src/reportlab/__init__.py
author robin
Thu, 21 Nov 2013 17:32:50 +0000
branchpy33
changeset 3820 47edc5ad9dc6
parent 3741 0cadc486be4a
child 3940 39b5e5c82ea1
permissions -rw-r--r--
move utils.py builtins defs to __init__.py
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3617
ae5744e97c42 reportlab: copyright date changes
robin
parents: 3612
diff changeset
     1
#Copyright ReportLab Europe Ltd. 2000-2012
494
54257447cfe9 Changed to indirect copyright
rgbecker
parents: 478
diff changeset
     2
#see license.txt for license details
2332
2a7ab4405e18 Remove $Header:, fix CopyRight & history
rgbecker
parents: 2216
diff changeset
     3
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py
2a7ab4405e18 Remove $Header:, fix CopyRight & history
rgbecker
parents: 2216
diff changeset
     4
__version__=''' $Id$ '''
681
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
     5
__doc__="""The Reportlab PDF generation library."""
3675
b40d6ba2ff81 bumped the version
Andy Robinson <andy@reportlab.com>
parents: 3617
diff changeset
     6
Version = "2.7"
2618
19c47ce76a0c changed version and added warning for old Python users
andy
parents: 2407
diff changeset
     7
19c47ce76a0c changed version and added warning for old Python users
andy
parents: 2407
diff changeset
     8
import sys
19c47ce76a0c changed version and added warning for old Python users
andy
parents: 2407
diff changeset
     9
3741
0cadc486be4a Satisfying Pillow's Python 3 deprecation warnings
Andy Robinson <andy@reportlab.com>
parents: 3675
diff changeset
    10
if sys.version_info[0:2] < (2, 7):
0cadc486be4a Satisfying Pillow's Python 3 deprecation warnings
Andy Robinson <andy@reportlab.com>
parents: 3675
diff changeset
    11
    warning = """The trunk of reportlab currently requires Python 2.7 or higher.
0cadc486be4a Satisfying Pillow's Python 3 deprecation warnings
Andy Robinson <andy@reportlab.com>
parents: 3675
diff changeset
    12
0cadc486be4a Satisfying Pillow's Python 3 deprecation warnings
Andy Robinson <andy@reportlab.com>
parents: 3675
diff changeset
    13
    This is being done to let us move forwards with 2.7/3.x compatibility
0cadc486be4a Satisfying Pillow's Python 3 deprecation warnings
Andy Robinson <andy@reportlab.com>
parents: 3675
diff changeset
    14
    with the minimum of baggage.
0cadc486be4a Satisfying Pillow's Python 3 deprecation warnings
Andy Robinson <andy@reportlab.com>
parents: 3675
diff changeset
    15
    
0cadc486be4a Satisfying Pillow's Python 3 deprecation warnings
Andy Robinson <andy@reportlab.com>
parents: 3675
diff changeset
    16
    ReportLab 2.7 was the last packaged version to suppo0rt Python 2.5 and 2.6.
3327
512eb20b0c3d more 2to3ing
andy
parents: 3316
diff changeset
    17
512eb20b0c3d more 2to3ing
andy
parents: 3316
diff changeset
    18
    Python 2.3 users may still use ReportLab 2.4 or any other bugfixes
3612
1f92ba58b133 updated version
andy
parents: 3454
diff changeset
    19
    derived from it, and Python 2.4 users may use ReportLab 2.5.  
1f92ba58b133 updated version
andy
parents: 3454
diff changeset
    20
    Python 2.2 and below need to use released versions beginning with 
1f92ba58b133 updated version
andy
parents: 3454
diff changeset
    21
    1.x (e.g. 1.21), or snapshots or checkouts from our 'version1' branch.
1f92ba58b133 updated version
andy
parents: 3454
diff changeset
    22
    
1f92ba58b133 updated version
andy
parents: 3454
diff changeset
    23
    Our current plan is to remove Python 2.5 compatibility on our next release,
1f92ba58b133 updated version
andy
parents: 3454
diff changeset
    24
    allowing us to use the 2to3 tool and work on Python 3.0 compatibility.
1f92ba58b133 updated version
andy
parents: 3454
diff changeset
    25
    If you have a choice, Python 2.7.x is best long term version to use.
2618
19c47ce76a0c changed version and added warning for old Python users
andy
parents: 2407
diff changeset
    26
    """
3612
1f92ba58b133 updated version
andy
parents: 3454
diff changeset
    27
    raise ImportError("reportlab needs Python 2.5 or higher", warning)
681
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    28
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    29
def getStory(context):
3327
512eb20b0c3d more 2to3ing
andy
parents: 3316
diff changeset
    30
    "This is a helper for our old autogenerated documentation system"
681
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    31
    if context.target == 'UserGuide':
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    32
        # parse some local file
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    33
        import os
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    34
        myDir = os.path.split(__file__)[0]
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    35
        import yaml
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    36
        return yaml.parseFile(myDir + os.sep + 'mydocs.yaml')
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    37
    else:
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    38
        # this signals that it should revert to default processing
934a4f24ea5d Added explicit font and encoding support
andy_robinson
parents: 625
diff changeset
    39
        return None
2216
aadcd9dc9480 Font reregistration cleanup
andy_robinson
parents: 2203
diff changeset
    40
aadcd9dc9480 Font reregistration cleanup
andy_robinson
parents: 2203
diff changeset
    41
aadcd9dc9480 Font reregistration cleanup
andy_robinson
parents: 2203
diff changeset
    42
def getMonitor():
aadcd9dc9480 Font reregistration cleanup
andy_robinson
parents: 2203
diff changeset
    43
    import reportlab.monitor
aadcd9dc9480 Font reregistration cleanup
andy_robinson
parents: 2203
diff changeset
    44
    mon = reportlab.monitor.ReportLabToolkitMonitor()
2407
71caad345e58 reportlab: release 1.20
rgbecker
parents: 2332
diff changeset
    45
    return mon
3820
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    46
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    47
#define these early in reportlab's life
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    48
isPy3 = sys.version_info[0]==3
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    49
if isPy3:
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    50
    def cmp(a,b):
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    51
        return -1 if a<b else (1 if a>b else 0)
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    52
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    53
    import builtins
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    54
    builtins.cmp = cmp
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    55
    del cmp, builtins
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    56
else:
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    57
    from future_builtins import ascii
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    58
    import __builtin__
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    59
    __builtin__.ascii = ascii
47edc5ad9dc6 move utils.py builtins defs to __init__.py
robin
parents: 3741
diff changeset
    60
    del ascii, __builtins__