Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
atlocal: Replace deprecated pkg_resources.
'pkg_resources' module is deprecated and no longer available in newer versions of python, so pytest tests are skipped: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html Unfortunately, there is no direct replacement for it and functionality is scattered between different packages. Using a new standard library importlib.metadata to find installed packages and their versions. Using packaging.requirements to parse lines from the requirements file and compare versions. This covers all we need. The 'packaging' is a project used by pip and a dependency for many other libraries, so should be available for any supported verison of python. 'importlib' was introduced in python 3.8. Since we support older versions of python and 'packaging' is not part of the standard library, checking that import is possible and falling back to 'pkg_resources' if needed. We may remove the fallback when we stop supporting python below 3.8. Even though 'packaging' is a common dependency, added to the test requirements so it will not be missed in CI. Acked-by: Eelco Chaudron <[email protected]> Signed-off-by: Ilya Maximets <[email protected]>
- Loading branch information