Closed andreikop closed 8 years ago
Aargh. Old packages are so painful. We definitely need a recent version; prior to 7-Nov-2015, regex had some serious fuzzy matching bugs. To fix this, I'd like to use pkg_resources
. Any objections?
import pkg_resources
# The `regex <https://pypi.python.org/pypi/regex>`_ module supports approximate
# matching. Make sure it is recent enough to be usable.
import regex
try:
# Get the version of regex. See https://pythonhosted.org/setuptools/pkg_resources.html#distribution-attributes.
regexVersion = pkg_resources.get_distribution('regex').parsed_version
# Issues I filed before this make regex unusable. See #166, #167, andd #169 at
# https://bitbucket.org/mrabarnett/mrab-regex/issues. For version parse, see
# https://pythonhosted.org/setuptools/pkg_resources.html#parsing-utilities.
assert regexVersion >= pkg_resources.parse_version('2015.11.07')
except AssertionError, ValueError:
raise ImportError
The fix is merged!
On Ubuntu 14.04 python-regex version 0.1.20140216-1 is available. With this version I have the following exception:
Bryan, could you check if we can leave with this version or should install regex from pip but not from .deb. Even if we can't work on old regex, we should recognize it and avoid exceptions.