Mercurial > hg > sworduploader
annotate sword2-libraries-pyinstaller-compatible/sword2/compatible_libs.py @ 22:d1752c7031e4 timeouts tip
Updated .hgignore to ignore sword2_logging.conf and anything in .cache
author | Steve Welburn <stephen.welburn@eecs.qmul.ac.uk> |
---|---|
date | Tue, 22 Jan 2013 14:43:42 +0000 |
parents | 8b69bba225c9 |
children |
rev | line source |
---|---|
marco@16 | 1 #!/usr/bin/env python |
marco@16 | 2 # -*- coding: utf-8 -*- |
marco@16 | 3 |
marco@16 | 4 """ |
marco@16 | 5 Provides the module with access to certain libraries that have more than one suitable implementation, in a optimally |
marco@16 | 6 degredating manner. |
marco@16 | 7 |
marco@16 | 8 Provides - `etree` and `json` |
marco@16 | 9 |
marco@16 | 10 `etree` can be from any of the following, if found in the local environment: |
marco@16 | 11 `lxml` |
marco@16 | 12 `xml.etree` |
marco@16 | 13 `elementtree` |
marco@16 | 14 `cElementTree` |
marco@16 | 15 |
marco@16 | 16 `json` can be from any of the following: |
marco@16 | 17 `json` (python >= 2.6) |
marco@16 | 18 `simplejson` |
marco@16 | 19 |
marco@16 | 20 If no suitable library is found, then it will pass back `None` |
marco@16 | 21 """ |
marco@16 | 22 |
marco@16 | 23 from sword2_logging import logging |
marco@16 | 24 |
marco@16 | 25 cl_l = logging.getLogger(__name__) |
marco@16 | 26 |
marco@16 | 27 try: |
marco@16 | 28 from lxml import etree |
marco@16 | 29 except ImportError: |
marco@16 | 30 try: |
marco@16 | 31 # Python >= 2.5 |
marco@16 | 32 from xml.etree import ElementTree as etree |
marco@16 | 33 except ImportError: |
marco@16 | 34 try: |
marco@16 | 35 from elementtree import ElementTree as etree |
marco@16 | 36 except ImportError: |
marco@16 | 37 try: |
marco@16 | 38 import cElementTree as etree |
marco@16 | 39 except ImportError: |
marco@16 | 40 cl_l.error("Couldn't find a suitable ElementTree library to use in this environment.") |
marco@16 | 41 etree = None |
marco@16 | 42 |
marco@16 | 43 try: |
marco@16 | 44 import json |
marco@16 | 45 except ImportError: |
marco@16 | 46 try: |
marco@16 | 47 import simplejson as json |
marco@16 | 48 except ImportError: |
marco@16 | 49 cl_l.error("Couldn't find a suitable simplejson-like library to use to serialise JSON") |
marco@16 | 50 json = None |