From f5b6579e1765a37fe104f79735909d3df9c314a8 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Thu, 16 May 2019 17:45:55 +0300 Subject: [PATCH] Prefer public packaging module to pkg_resources' private copy of it (#826) Some distributions of `pkg_resources` remove the vendored copy of `packaging. Additionally, the vendored copy is not publicly documented and should not be relied on exclusively. Regardless, if `pkg_resources` is installed at all, then we can be fairly certain one of `packaging` or `pkg_resources._vendor.packaging` will be available. That being the case, there is no need to list `packaging` as a dependency. Fixes #825. --- docs/change_log/index.md | 2 ++ markdown/__meta__.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/change_log/index.md b/docs/change_log/index.md index 9e2b27a1f..7be68ad2a 100644 --- a/docs/change_log/index.md +++ b/docs/change_log/index.md @@ -7,6 +7,8 @@ _______, 2019: Released version 3.1.1 (a bug-fix release). * Fixed import failure in `setup.py` when the source directory is not on `sys.path` (#823). +* Prefer public `packaging` module to pkg_resources' private copy of + it (#825). Mar 25, 2019: Released version 3.1 ([Notes](release-3.1.md)). diff --git a/markdown/__meta__.py b/markdown/__meta__.py index fcbd47bb9..f46185d77 100644 --- a/markdown/__meta__.py +++ b/markdown/__meta__.py @@ -20,7 +20,10 @@ License: BSD (see LICENSE.md for details). """ -from pkg_resources.extern import packaging +try: + import packaging.version +except ImportError: + from pkg_resources.extern import packaging # __version_info__ format: # (major, minor, patch, dev/alpha/beta/rc/final, #)