__init__.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #Copyright ReportLab Europe Ltd. 2000-2021
  2. #see license.txt for license details
  3. __doc__="""The Reportlab PDF generation library."""
  4. Version = "3.6.1"
  5. __version__=Version
  6. __date__='20210806'
  7. import sys, os
  8. __min_python_version__ = (3,6)
  9. if sys.version_info< __min_python_version__:
  10. raise ImportError("""reportlab requires %s.%s+; other versions are unsupported.
  11. If you want to try with other python versions edit line 10 of reportlab/__init__
  12. to remove this error.""" % (__min_python_version__))
  13. #define these early in reportlab's life
  14. def cmp(a,b):
  15. return -1 if a<b else (1 if a>b else 0)
  16. def _fake_import(fn,name):
  17. from importlib import machinery
  18. m = machinery.SourceFileLoader(name,fn)
  19. try:
  20. sys.modules[name] = m.load_module(name)
  21. except FileNotFoundError:
  22. raise ImportError('file %s not found' % ascii(fn))
  23. #try to use dynamic modifications from
  24. #reportlab.local_rl_mods.py
  25. #reportlab_mods.py or ~/.reportlab_mods
  26. try:
  27. import reportlab.local_rl_mods
  28. except ImportError:
  29. pass
  30. try:
  31. import reportlab_mods #application specific modifications can be anywhere on python path
  32. except ImportError:
  33. try:
  34. _fake_import(os.path.expanduser(os.path.join('~','.reportlab_mods')),'reportlab_mods')
  35. except (ImportError,KeyError,PermissionError):
  36. pass