From 305f00ec042a55aa55f7c3096d5766f87be1c011 Mon Sep 17 00:00:00 2001 From: Josh McVey Date: Mon, 22 Jul 2024 14:24:38 -0500 Subject: [PATCH] fix(scripts): setuptools v71 removed the need for extern (#15717) (#15741) ## `cherry-pick` afaa7177fe Must update `chore_release-7.4.0` so that Linux app builds work due to a change in setuptools. To understand the changes see #15717 Co-authored-by: Ryan Howard --- scripts/python_build_utils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/python_build_utils.py b/scripts/python_build_utils.py index d55ece0e0c8..eff17678fda 100644 --- a/scripts/python_build_utils.py +++ b/scripts/python_build_utils.py @@ -54,9 +54,18 @@ def normalize_version(package, project, extra_tag='', git_dir=None): # the way they vendor dependencies, like the packaging module that # provides the way to normalize version numbers for wheel file names. So # we try all the possible ways to find it. + # Since 71.0.0 they have removed the need for extern + # So depending on the version of 3.10 you're building on you may or may not + # need to use the extern or import it directly try: - # new way - from setuptools.extern import packaging + import setuptools + major, minor, patch = [int(x, 10) for x in setuptools.__version__.split('.')] + if major < 71: + # new way + from setuptools.extern import packaging + else: + # new new way + import packaging except ImportError: # old way from pkg_resources.extern import packaging