diff --git a/bin/reportlab/__init__.py b/bin/reportlab/__init__.py new file mode 100644 index 00000000000..5a381ed9b26 --- /dev/null +++ b/bin/reportlab/__init__.py @@ -0,0 +1,33 @@ +#Copyright ReportLab Europe Ltd. 2000-2004 +#see license.txt for license details +#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py +__version__=''' $Id: __init__.py 2877 2006-05-18 15:11:23Z andy $ ''' +__doc__="""The Reportlab PDF generation library.""" +Version = "2.0" + +import sys + +if sys.version_info[0:2] < (2, 3): + warning = """The trunk of reportlab requires Python 2.3 or higher. + Any older applications should either use released versions beginning + with 1.x (e.g. 1.21), or snapshots or checkouts from our 'version1' + branch. + """ + raise ImportError("reportlab needs Python 2.3 or higher", warning) + +def getStory(context): + if context.target == 'UserGuide': + # parse some local file + import os + myDir = os.path.split(__file__)[0] + import yaml + return yaml.parseFile(myDir + os.sep + 'mydocs.yaml') + else: + # this signals that it should revert to default processing + return None + + +def getMonitor(): + import reportlab.monitor + mon = reportlab.monitor.ReportLabToolkitMonitor() + return mon diff --git a/bin/reportlab/rl_config.py b/bin/reportlab/rl_config.py new file mode 100644 index 00000000000..fed48d5d027 --- /dev/null +++ b/bin/reportlab/rl_config.py @@ -0,0 +1,155 @@ +#Copyright ReportLab Europe Ltd. 2000-2004 +#see license.txt for license details +#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/rl_config.py +__version__=''' $Id: rl_config.py 2899 2006-05-22 12:42:07Z rgbecker $ ''' + +allowTableBoundsErrors = 1 # set to 0 to die on too large elements in tables in debug (recommend 1 for production use) +shapeChecking = 1 +defaultEncoding = 'WinAnsiEncoding' # 'WinAnsi' or 'MacRoman' +defaultGraphicsFontName= 'Times-Roman' #initializer for STATE_DEFAULTS in shapes.py +pageCompression = 1 # default page compression mode +defaultPageSize = 'A4' #default page size +defaultImageCaching = 0 #set to zero to remove those annoying cached images +ZLIB_WARNINGS = 1 +warnOnMissingFontGlyphs = 0 #if 1, warns of each missing glyph +verbose = 0 +showBoundary = 0 # turns on and off boundary behaviour in Drawing +emptyTableAction= 'error' # one of 'error', 'indicate', 'ignore' +invariant= 0 #produces repeatable,identical PDFs with same timestamp info (for regression testing) +eps_preview_transparent= None #set to white etc +overlapAttachedSpace= 1 #if set non false then adajacent flowable space after + #and space before are merged (max space is used). +longTableOptimize = 0 #default don't use Henning von Bargen's long table optimizations +autoConvertEncoding = 0 #convert internally as needed (experimental) +_FUZZ= 1e-6 #fuzz for layout arithmetic + +# places to look for T1Font information +T1SearchPath = ( + 'c:/Program Files/Adobe/Acrobat 9.0/Resource/Font', + 'c:/Program Files/Adobe/Acrobat 8.0/Resource/Font', + 'c:/Program Files/Adobe/Acrobat 7.0/Resource/Font', + 'c:/Program Files/Adobe/Acrobat 6.0/Resource/Font', #Win32, Acrobat 6 + 'c:/Program Files/Adobe/Acrobat 5.0/Resource/Font', #Win32, Acrobat 5 + 'c:/Program Files/Adobe/Acrobat 4.0/Resource/Font', #Win32, Acrobat 4 + '%(disk)s/Applications/Python %(sys_version)s/reportlab/fonts', #Mac? + '/usr/lib/Acrobat9/Resource/Font', #Linux, Acrobat 5? + '/usr/lib/Acrobat8/Resource/Font', #Linux, Acrobat 5? + '/usr/lib/Acrobat7/Resource/Font', #Linux, Acrobat 5? + '/usr/lib/Acrobat6/Resource/Font', #Linux, Acrobat 5? + '/usr/lib/Acrobat5/Resource/Font', #Linux, Acrobat 5? + '/usr/lib/Acrobat4/Resource/Font', #Linux, Acrobat 4 + '/usr/local/Acrobat9/Resource/Font', #Linux, Acrobat 5? + '/usr/local/Acrobat8/Resource/Font', #Linux, Acrobat 5? + '/usr/local/Acrobat7/Resource/Font', #Linux, Acrobat 5? + '/usr/local/Acrobat6/Resource/Font', #Linux, Acrobat 5? + '/usr/local/Acrobat5/Resource/Font', #Linux, Acrobat 5? + '/usr/local/Acrobat4/Resource/Font', #Linux, Acrobat 4 + '%(REPORTLAB_DIR)s/fonts', #special + '%(REPORTLAB_DIR)s/../fonts', #special + '%(REPORTLAB_DIR)s/../../fonts', #special + '%(HOME)s/fonts', #special + ) + +# places to look for TT Font information +TTFSearchPath = ( + 'c:/winnt/fonts', + 'c:/windows/fonts', + '/usr/lib/X11/fonts/TrueType/', + '%(REPORTLAB_DIR)s/fonts', #special + '%(REPORTLAB_DIR)s/../fonts', #special + '%(REPORTLAB_DIR)s/../../fonts',#special + '%(HOME)s/fonts', #special + ) + +# places to look for CMap files - should ideally merge with above +CMapSearchPath = ( + '/usr/lib/Acrobat9/Resource/CMap', + '/usr/lib/Acrobat8/Resource/CMap', + '/usr/lib/Acrobat7/Resource/CMap', + '/usr/lib/Acrobat6/Resource/CMap', + '/usr/lib/Acrobat5/Resource/CMap', + '/usr/lib/Acrobat4/Resource/CMap', + '/usr/local/Acrobat9/Resource/CMap', + '/usr/local/Acrobat8/Resource/CMap', + '/usr/local/Acrobat7/Resource/CMap', + '/usr/local/Acrobat6/Resource/CMap', + '/usr/local/Acrobat5/Resource/CMap', + '/usr/local/Acrobat4/Resource/CMap', + 'C:\\Program Files\\Adobe\\Acrobat\\Resource\\CMap', + 'C:\\Program Files\\Adobe\\Acrobat 9.0\\Resource\\CMap', + 'C:\\Program Files\\Adobe\\Acrobat 8.0\\Resource\\CMap', + 'C:\\Program Files\\Adobe\\Acrobat 7.0\\Resource\\CMap', + 'C:\\Program Files\\Adobe\\Acrobat 6.0\\Resource\\CMap', + 'C:\\Program Files\\Adobe\\Acrobat 5.0\\Resource\\CMap', + 'C:\\Program Files\\Adobe\\Acrobat 4.0\\Resource\\CMap', + '%(REPORTLAB_DIR)s/fonts/CMap', #special + '%(REPORTLAB_DIR)s/../fonts/CMap', #special + '%(REPORTLAB_DIR)s/../../fonts/CMap', #special + '%(HOME)s/fonts/CMap', #special + ) + +#### Normally don't need to edit below here #### +try: + from local_rl_config import * +except: + pass + +_SAVED = {} +sys_version=None + +def _setOpt(name, value, conv=None): + '''set a module level value from environ/default''' + from os import environ + ename = 'RL_'+name + if environ.has_key(ename): + value = environ[ename] + if conv: value = conv(value) + globals()[name] = value + +def _startUp(): + '''This function allows easy resetting to the global defaults + If the environment contains 'RL_xxx' then we use the value + else we use the given default''' + V = ('T1SearchPath','CMapSearchPath', 'TTFSearchPath', + 'shapeChecking', 'defaultEncoding', + 'pageCompression', 'defaultPageSize', 'defaultImageCaching', + 'ZLIB_WARNINGS', 'warnOnMissingFontGlyphs', 'verbose', 'emptyTableAction', + 'invariant','eps_preview_transparent', + ) + import os, sys, string + global sys_version, _unset_ + sys_version = string.split(sys.version)[0] #strip off the other garbage + from reportlab.lib import pagesizes + from reportlab.lib.utils import rl_isdir + + if _SAVED=={}: + _unset_ = getattr(sys,'_rl_config__unset_',None) + if _unset_ is None: + class _unset_: pass + sys._rl_config__unset_ = _unset_ = _unset_() + for k in V: + _SAVED[k] = globals()[k] + + #places to search for Type 1 Font files + import reportlab + D = {'REPORTLAB_DIR': os.path.abspath(os.path.dirname(reportlab.__file__)), + 'HOME': os.environ.get('HOME',os.getcwd()), + 'disk': string.split(os.getcwd(), ':')[0], + 'sys_version': sys_version, + } + + for name in ('T1SearchPath','TTFSearchPath','CMapSearchPath'): + P=[] + for p in _SAVED[name]: + d = string.replace(p % D,'/',os.sep) + if rl_isdir(d): P.append(d) + _setOpt(name,P) + + for k in V[3:]: + v = _SAVED[k] + if type(v)==type(1): conv = int + elif k=='defaultPageSize': conv = lambda v,M=pagesizes: getattr(M,v) + else: conv = None + _setOpt(k,v,conv) + +_startUp() diff --git a/bin/reportlab/setup.py b/bin/reportlab/setup.py new file mode 100644 index 00000000000..96f7d1ee69e --- /dev/null +++ b/bin/reportlab/setup.py @@ -0,0 +1,258 @@ +#Copyright ReportLab Europe Ltd. 2000-2004 +#see license.txt for license details +#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/setup.py +__version__=''' $Id: setup.py 2511 2005-01-14 15:42:12Z rgbecker $ ''' + +import os, sys, distutils, glob +from distutils.core import setup, Extension + +# from Zope - App.Common.package_home + +def package_home(globals_dict): + __name__=globals_dict['__name__'] + m=sys.modules[__name__] + r=os.path.split(m.__path__[0])[0] + return r + +pjoin = os.path.join +abspath = os.path.abspath +isfile = os.path.isfile +isdir = os.path.isfile +dirname = os.path.dirname +package_path = pjoin(package_home(distutils.__dict__), 'site-packages', 'reportlab') + +def get_version(): + #determine Version + if __name__=='__main__': + HERE=os.path.dirname(sys.argv[0]) + else: + HERE=os.path.dirname(__file__) + + #first try source + FN = pjoin(HERE,'__init__') + try: + for l in open(pjoin(FN+'.py'),'r').readlines(): + if l.startswith('Version'): + exec l.strip() + return Version + except: + pass + + #don't have source, try import + import imp + for desc in ('.pyc', 'rb', 2), ('.pyo', 'rb', 2): + try: + fn = FN+desc[0] + f = open(fn,desc[1]) + m = imp.load_module('reportlab',f,fn,desc) + return m.Version + except: + pass + raise ValueError('Cannot determine ReportLab Version') + +def getVersionFromCCode(fn): + import re + tag = re.search(r'^#define\s+VERSION\s+"([^"]*)"',open(fn,'r').read(),re.M) + return tag and tag.group(1) or '' + +def _rl_accel_dir_info(dir): + import stat + fn = pjoin(dir,'_rl_accel') + return getVersionFromCCode(fn),os.stat(fn)[stat.ST_MTIME] + +def _cmp_rl_accel_dirs(a,b): + return cmp(_rl_accel_dir_info(b),__rl_accel_dir_info(a)) + +def _find_rl_accel(): + '''locate where the accelerator code lives''' + _ = [] + for x in [ + './rl_addons/rl_accel', + '../rl_addons/rl_accel', + '../../rl_addons/rl_accel', + './rl_accel', + '../rl_accel', + '../../rl_accel', + './lib'] \ + + glob.glob('./rl_accel-*/rl_accel')\ + + glob.glob('../rl_accel-*/rl_accel') \ + + glob.glob('../../rl_accel-*/rl_accel') \ + : + fn = pjoin(x,'_rl_accel.c') + if isfile(pjoin(x,'_rl_accel.c')): + _.append(x) + if _: + if len(_)>1: _.sort(_cmp_rl_accel_dirs) + return abspath(_[0]) + return None + +_FILES= [ + 'README', + 'changes', + 'license.txt', + + 'demos/colors/colortest.py', + 'demos/gadflypaper/00readme.txt', + 'demos/gadflypaper/gfe.py', + 'demos/odyssey/00readme.txt', + 'demos/odyssey/dodyssey.py', + 'demos/odyssey/fodyssey.py', + 'demos/odyssey/odyssey.py', + 'demos/odyssey/odyssey.txt', + 'demos/rlzope/readme.txt', + 'demos/rlzope/rlzope.py', + 'demos/stdfonts/00readme.txt', + 'demos/stdfonts/stdfonts.py', + 'demos/tests/testdemos.py', + + 'docs/00readme.txt', + 'docs/genAll.py', + 'docs/graphguide/ch1_intro.py', + 'docs/graphguide/ch2_concepts.py', + 'docs/graphguide/ch3_shapes.py', + 'docs/graphguide/ch4_widgets.py', + 'docs/graphguide/ch5_charts.py', + 'docs/graphguide/gengraphguide.py', + 'docs/images/Edit_Prefs.gif', + 'docs/images/Python_21.gif', + 'docs/images/Python_21_HINT.gif', + 'docs/images/fileExchange.gif', + 'docs/images/jpn.gif', + 'docs/images/jpnchars.jpg', + 'docs/images/lj8100.jpg', + 'docs/images/replogo.a85', + 'docs/images/replogo.gif', + 'docs/reference/build.bat', + 'docs/reference/genreference.py', + 'docs/reference/reference.yml', + 'docs/userguide/app_demos.py', + 'docs/userguide/ch1_intro.py', + 'docs/userguide/ch2_graphics.py', + 'docs/userguide/ch2a_fonts.py', + 'docs/userguide/ch3_pdffeatures.py', + 'docs/userguide/ch4_platypus_concepts.py', + 'docs/userguide/ch5_paragraphs.py', + 'docs/userguide/ch6_tables.py', + 'docs/userguide/ch7_custom.py', + 'docs/userguide/ch9_future.py', + 'docs/userguide/genuserguide.py', + 'docs/userguide/testfile.txt', + + 'extensions/README', + + 'fonts/00readme.txt', + 'fonts/LeERC___.AFM', + 'fonts/LeERC___.PFB', + 'fonts/luxiserif.ttf', + 'fonts/luxiserif_license.txt', + 'fonts/rina.ttf', + 'fonts/rina_license.txt', + + 'test/pythonpowered.gif', + + 'tools/README', + 'tools/docco/README', + 'tools/py2pdf/README', + 'tools/py2pdf/demo-config.txt', + 'tools/py2pdf/vertpython.jpg', + 'tools/pythonpoint/README', + 'tools/pythonpoint/pythonpoint.dtd', + 'tools/pythonpoint/demos/htu.xml', + 'tools/pythonpoint/demos/LeERC___.AFM', + 'tools/pythonpoint/demos/LeERC___.PFB', + 'tools/pythonpoint/demos/leftlogo.a85', + 'tools/pythonpoint/demos/leftlogo.gif', + 'tools/pythonpoint/demos/lj8100.jpg', + 'tools/pythonpoint/demos/monterey.xml', + 'tools/pythonpoint/demos/outline.gif', + 'tools/pythonpoint/demos/pplogo.gif', + 'tools/pythonpoint/demos/python.gif', + 'tools/pythonpoint/demos/pythonpoint.xml', + 'tools/pythonpoint/demos/spectrum.png', + 'tools/pythonpoint/demos/vertpython.gif', + ] +# why oh why don't most setup scripts have a script handler? +# if you don't have one, you can't edit in Pythonwin +def run(): + RL_ACCEL = _find_rl_accel() + LIBS = [] + DATA_FILES = {} + if not RL_ACCEL: + EXT_MODULES = [] + print '***************************************************' + print '*No rl_accel code found, you can obtain it at *' + print '*http://www.reportlab.org/downloads.html#_rl_accel*' + print '***************************************************' + else: + fn = pjoin(RL_ACCEL,'lib','hyphen.mashed') + if isfile(fn): DATA_FILES[pjoin(package_path, 'lib')] = [fn] + EXT_MODULES = [ + Extension( '_rl_accel', + [pjoin(RL_ACCEL,'_rl_accel.c')], + include_dirs=[], + define_macros=[], + library_dirs=[], + libraries=LIBS, # libraries to link against + ), + Extension( 'sgmlop', + [pjoin(RL_ACCEL,'sgmlop.c')], + include_dirs=[], + define_macros=[], + library_dirs=[], + libraries=LIBS, # libraries to link against + ), + Extension( 'pyHnj', + [pjoin(RL_ACCEL,'pyHnjmodule.c'), + pjoin(RL_ACCEL,'hyphen.c'), + pjoin(RL_ACCEL,'hnjalloc.c')], + include_dirs=[], + define_macros=[], + library_dirs=[], + libraries=LIBS, # libraries to link against + ), + ] + for fn in _FILES: + fn = os.sep.join(fn.split('/')) + if isfile(fn): + tn = dirname(fn) + tn = tn and pjoin(package_path,tn) or package_path + DATA_FILES.setdefault(tn,[]).append(fn) + setup( + name="Reportlab", + version=get_version(), + license="BSD license (see license.txt for details), Copyright (c) 2000-2003, ReportLab Inc.", + description="The Reportlab Toolkit", + long_description="""The ReportLab Toolkit. +An Open Source Python library for generating PDFs and graphics. +""", + + author="Robinson, Watters, Becker, Precedo and many more...", + author_email="info@reportlab.com", + url="http://www.reportlab.com/", + + package_dir = {'reportlab': '.'}, + + packages=[ # include anything with an __init__ + 'reportlab', + 'reportlab.extensions', + 'reportlab.graphics.charts', + 'reportlab.graphics.samples', + 'reportlab.graphics.widgets', + 'reportlab.graphics', + 'reportlab.lib', + 'reportlab.pdfbase', + 'reportlab.pdfgen', + 'reportlab.platypus', + 'reportlab.test', + 'reportlab.tools.docco', + 'reportlab.tools.py2pdf', + 'reportlab.tools.pythonpoint.styles', + 'reportlab.tools.pythonpoint', + 'reportlab.tools', + ], + data_files = DATA_FILES.items(), + ext_modules = EXT_MODULES, + ) + +if __name__=='__main__': + run()