From: JinWang An Date: Mon, 27 Mar 2023 08:02:41 +0000 (+0900) Subject: Imported Upstream version 60.0.3 X-Git-Tag: upstream/60.0.3^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15a086abf3fbbb754444d6de1ee0ba91087503f6;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 60.0.3 --- diff --git a/.bumpversion.cfg b/.bumpversion.cfg index aff2d44..bb1c47a 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 60.0.2 +current_version = 60.0.3 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 4d66fa1..4fab510 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v60.0.3 +------- + + +Misc +^^^^ +* #2940: Avoid KeyError in distutils hack when pip is imported during ensurepip. + + v60.0.2 ------- diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index ae97a0b..22bc9ed 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -106,17 +106,25 @@ class DistutilsMetaFinder: clear_distutils() self.spec_for_distutils = lambda: None - @staticmethod - def pip_imported_during_build(): + @classmethod + def pip_imported_during_build(cls): """ Detect if pip is being imported in a build script. Ref #2355. """ import traceback return any( - frame.f_globals['__file__'].endswith('setup.py') + cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None) ) + @staticmethod + def frame_file_is_setup(frame): + """ + Return True if the indicated frame suggests a setup.py file. + """ + # some frames may not have __file__ (#2940) + return frame.f_globals.get('__file__', '').endswith('setup.py') + DISTUTILS_FINDER = DistutilsMetaFinder() diff --git a/setup.cfg b/setup.cfg index d6a59e1..77095b6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = setuptools -version = 60.0.2 +version = 60.0.3 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages