This is an automated email from the ASF dual-hosted git repository. juergbi pushed a commit to branch juerg/update-fixes in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 5d917f3066f45e891984836adb7430d54af30d0c Author: Jürg Billeter <[email protected]> AuthorDate: Fri Jul 26 14:36:07 2024 +0200 pluginoriginpip.py: Fix error type for setuptools 70 --- src/buildstream/_pluginfactory/pluginoriginpip.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/buildstream/_pluginfactory/pluginoriginpip.py b/src/buildstream/_pluginfactory/pluginoriginpip.py index a50534f60..542776e0b 100644 --- a/src/buildstream/_pluginfactory/pluginoriginpip.py +++ b/src/buildstream/_pluginfactory/pluginoriginpip.py @@ -34,6 +34,13 @@ class PluginOriginPip(PluginOrigin): import pkg_resources + try: + # For setuptools >= 70 + import packaging + except ImportError: + # For setuptools < 70 + from pkg_resources.extern import packaging + # Sources and elements are looked up in separate # entrypoint groups from the same package. # @@ -66,7 +73,7 @@ class PluginOriginPip(PluginOrigin): # For setuptools < 49.0.0 pkg_resources.RequirementParseError, # For setuptools >= 49.0.0 - pkg_resources.extern.packaging.requirements.InvalidRequirement, + packaging.requirements.InvalidRequirement, ) as e: raise PluginError( "{}: Malformed package-name '{}' encountered: {}".format(
