diff --git a/pyeclib/ec_iface.py b/pyeclib/ec_iface.py index 1b429cf..1830744 100644 --- a/pyeclib/ec_iface.py +++ b/pyeclib/ec_iface.py @@ -28,6 +28,12 @@ from .utils import create_instance from .utils import positive_int_value from pyeclib_c import get_liberasurecode_version +import logging +from logging.handlers import SysLogHandler +logger = logging.getLogger('pyeclib') +syslog_handler = SysLogHandler() +logger.addHandler(syslog_handler) + def check_backend_available(backend_name): try: @@ -527,6 +533,18 @@ def _liberasurecode_version(): minor = str(int(version_hex_str[-4:-2])) rev = str(int(version_hex_str[-2:])) version_str = '.'.join([major, minor, rev]) + + # liberasurecode < 1.3.1 should be incompatible but + # just warn until packagers build the required version + # See https://bugs.launchpad.net/swift/+bug/1639691 in detail + required_version = ((1 << 16) + (3 << 8) + 1) + if version_int < required_version: + logger.warning( + 'DEPRECATED WARNING: your liberasurecode ' + '%s will be deprecated in the near future because of the issue ' + 'https://bugs.launchpad.net/swift/+bug/1639691; ' + 'Please upgrade to >=1.3.1 and rebuild pyeclib to suppress ' + 'this message' % version_str) return version_str LIBERASURECODE_VERSION = _liberasurecode_version()