From 15211992823de2eb5230a8b0e83b4a6e84fcd6a6 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 30 Dec 2020 07:07:56 +0900 Subject: [PATCH] Imported Upstream version 49.3.2 --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 ++++++++- docs/pkg_resources.txt | 12 ++++++------ docs/setuptools.txt | 12 ++++++------ setup.cfg | 2 +- setuptools/command/bdist_egg.py | 7 ++++--- setuptools/command/build_ext.py | 10 ++++++---- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index bb1e621..5e0d7fd 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 49.3.1 +current_version = 49.3.2 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index df0230e..2add741 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,4 +1,11 @@ -vv49.3.1 +v49.3.2 +------- + +* #2300: Improve the ``safe_version`` function documentation +* #2297: Once again, in stubs prefer exec_module to the deprecated load_module. + + +v49.3.1 -------- * #2316: Removed warning when ``distutils`` is imported before ``setuptools`` when ``distutils`` replacement is not enabled. diff --git a/docs/pkg_resources.txt b/docs/pkg_resources.txt index f2e554f..7d0d8da 100644 --- a/docs/pkg_resources.txt +++ b/docs/pkg_resources.txt @@ -1596,12 +1596,12 @@ Parsing Utilities See ``to_filename()``. ``safe_version(version)`` - This will return the normalized form of any PEP 440 version, if the version - string is not PEP 440 compatible than it is similar to ``safe_name()`` - except that spaces in the input become dots, and dots are allowed to exist - in the output. As with ``safe_name()``, if you are generating a filename - from this you should replace any "-" characters in the output with - underscores. + This will return the normalized form of any PEP 440 version. If the version + string is not PEP 440 compatible, this function behaves similar to + ``safe_name()`` except that spaces in the input become dots, and dots are + allowed to exist in the output. As with ``safe_name()``, if you are + generating a filename from this you should replace any "-" characters in + the output with underscores. ``safe_extra(extra)`` Return a "safe" form of an extra's name, suitable for use in a requirement diff --git a/docs/setuptools.txt b/docs/setuptools.txt index 7e0914b..d60c87a 100644 --- a/docs/setuptools.txt +++ b/docs/setuptools.txt @@ -1988,11 +1988,11 @@ boilerplate code in some cases. include_package_data = True packages = find: scripts = - bin/first.py - bin/second.py + bin/first.py + bin/second.py install_requires = - requests - importlib; python_version == "2.6" + requests + importlib; python_version == "2.6" [options.package_data] * = *.txt, *.rst @@ -2028,8 +2028,8 @@ Metadata and options are set in the config sections of the same name. [metadata] keywords = - one - two + one + two * In some cases, complex values can be provided in dedicated subsections for clarity. diff --git a/setup.cfg b/setup.cfg index 5244019..5d4a084 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ formats = zip [metadata] name = setuptools -version = 49.3.1 +version = 49.3.2 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 7af3165..4be1545 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -55,11 +55,12 @@ def write_stub(resource, pyfile): _stub_template = textwrap.dedent(""" def __bootstrap__(): global __bootstrap__, __loader__, __file__ - import sys, pkg_resources - from importlib.machinery import ExtensionFileLoader + import sys, pkg_resources, importlib.util __file__ = pkg_resources.resource_filename(__name__, %r) __loader__ = None; del __bootstrap__, __loader__ - ExtensionFileLoader(__name__,__file__).load_module() + spec = importlib.util.spec_from_file_location(__name__,__file__) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) __bootstrap__() """).lstrip() with open(pyfile, 'w') as f: diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 0eb29ad..89a0e32 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -254,8 +254,8 @@ class build_ext(_build_ext): '\n'.join([ "def __bootstrap__():", " global __bootstrap__, __file__, __loader__", - " import sys, os, pkg_resources" + if_dl(", dl"), - " from importlib.machinery import ExtensionFileLoader", + " import sys, os, pkg_resources, importlib.util" + + if_dl(", dl"), " __file__ = pkg_resources.resource_filename" "(__name__,%r)" % os.path.basename(ext._file_name), @@ -267,8 +267,10 @@ class build_ext(_build_ext): " try:", " os.chdir(os.path.dirname(__file__))", if_dl(" sys.setdlopenflags(dl.RTLD_NOW)"), - " ExtensionFileLoader(__name__,", - " __file__).load_module()", + " spec = importlib.util.spec_from_file_location(", + " __name__, __file__)", + " mod = importlib.util.module_from_spec(spec)", + " spec.loader.exec_module(mod)", " finally:", if_dl(" sys.setdlopenflags(old_flags)"), " os.chdir(old_dir)", -- 2.34.1