def _check_version(module, min_version): try: from packaging import version as _version _parser = _version.parse except ImportError: # pkg_resources is an order of magnitude slower to import than # packaging. Only use it if the preferred (but optional) # packaging library is not present from pkg_resources import parse_version as _parser version = getattr(module, '__version__', '0.0.0') return _parser(min_version) <= _parser(version)
def check_min_version(module, min_version): if isinstance(module, DeferredImportModule): indicator = module._indicator_flag indicator.resolve() if indicator._available: module = indicator._module else: return False try: from packaging import version as _version _parser = _version.parse except ImportError: # pkg_resources is an order of magnitude slower to import than # packaging. Only use it if the preferred (but optional) # packaging library is not present from pkg_resources import parse_version as _parser version = getattr(module, '__version__', '0.0.0') return _parser(min_version) <= _parser(version)
def _check_version(module, min_version): version = getattr(module, '__version__', '0.0.0') return _parser(min_version) <= _parser(version)
def _check_version(module, min_version): return _parser(min_version) <= _parser(module.__version__)