From 100e981281f1dc1a22a45697fa137e60470165c1 Mon Sep 17 00:00:00 2001 From: JinWang An Date: Mon, 27 Mar 2023 17:02:39 +0900 Subject: [PATCH] Imported Upstream version 59.5.0 --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++ docs/userguide/dependency_management.rst | 2 +- docs/userguide/quickstart.rst | 2 +- pkg_resources/__init__.py | 25 ++++++++++--------- setup.cfg | 2 +- setuptools/_distutils/command/install.py | 9 +++++-- .../_distutils/tests/test_unixccompiler.py | 7 +++++- setuptools/dist.py | 7 ++++-- 9 files changed, 44 insertions(+), 21 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 9dfdfbd..c7ced0e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 59.4.0 +current_version = 59.5.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 58f35ed..7d7bfc7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v59.5.0 +------- + + +Changes +^^^^^^^ +* #2914: Merge with pypa/distutils@8f2df0bf6. + + v59.4.0 ------- diff --git a/docs/userguide/dependency_management.rst b/docs/userguide/dependency_management.rst index 23578a5..9c29dbd 100644 --- a/docs/userguide/dependency_management.rst +++ b/docs/userguide/dependency_management.rst @@ -360,6 +360,6 @@ or ``setup.py``. setup( name="Project-B", - python_requires=[">=3.6"], + python_requires=">=3.6", ..., ) diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 6bf353a..98e34c1 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -159,7 +159,7 @@ When your project is installed, all of the dependencies not already installed will be located (via PyPI), downloaded, built (if necessary), and installed. This, of course, is a simplified scenarios. ``setuptools`` also provide additional keywords such as ``setup_requires`` that allows you to install -dependencies before running the script, and ``extras_requires`` that take +dependencies before running the script, and ``extras_require`` that take care of those needed by automatically generated scripts. It also provides mechanisms to handle dependencies that are not in PyPI. For more advanced use, see :doc:`dependency_management` diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 42129d5..955fdc4 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2396,18 +2396,19 @@ def _set_parent_ns(packageName): setattr(sys.modules[parent], name, sys.modules[packageName]) -def yield_lines(strs): - """Yield non-empty/non-comment lines of a string or sequence""" - if isinstance(strs, str): - for s in strs.splitlines(): - s = s.strip() - # skip blank lines/comments - if s and not s.startswith('#'): - yield s - else: - for ss in strs: - for s in yield_lines(ss): - yield s +def _nonblank(str): + return str and not str.startswith('#') + + +@functools.singledispatch +def yield_lines(iterable): + """Yield valid lines of a string or iterable""" + return itertools.chain.from_iterable(map(yield_lines, iterable)) + + +@yield_lines.register(str) +def _(text): + return filter(_nonblank, map(str.strip, text.splitlines())) MODULE = re.compile(r"\w+(\.\w+)*$").match diff --git a/setup.cfg b/setup.cfg index b96c2f2..f1ffad7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = setuptools -version = 59.4.0 +version = 59.5.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages diff --git a/setuptools/_distutils/command/install.py b/setuptools/_distutils/command/install.py index c756b6d..18b352f 100644 --- a/setuptools/_distutils/command/install.py +++ b/setuptools/_distutils/command/install.py @@ -471,8 +471,13 @@ class install(Command): raise DistutilsOptionError( "must not supply exec-prefix without prefix") - self.prefix = os.path.normpath(sys.prefix) - self.exec_prefix = os.path.normpath(sys.exec_prefix) + # Allow Fedora to add components to the prefix + _prefix_addition = getattr(sysconfig, '_prefix_addition', "") + + self.prefix = ( + os.path.normpath(sys.prefix) + _prefix_addition) + self.exec_prefix = ( + os.path.normpath(sys.exec_prefix) + _prefix_addition) else: if self.exec_prefix is None: diff --git a/setuptools/_distutils/tests/test_unixccompiler.py b/setuptools/_distutils/tests/test_unixccompiler.py index 63c7dd3..2ea93da 100644 --- a/setuptools/_distutils/tests/test_unixccompiler.py +++ b/setuptools/_distutils/tests/test_unixccompiler.py @@ -11,9 +11,12 @@ from distutils.errors import DistutilsPlatformError from distutils.unixccompiler import UnixCCompiler from distutils.util import _clear_cached_macosx_ver -class UnixCCompilerTestCase(unittest.TestCase): +from . import support + +class UnixCCompilerTestCase(support.TempdirManager, unittest.TestCase): def setUp(self): + super().setUp() self._backup_platform = sys.platform self._backup_get_config_var = sysconfig.get_config_var self._backup_get_config_vars = sysconfig.get_config_vars @@ -23,6 +26,7 @@ class UnixCCompilerTestCase(unittest.TestCase): self.cc = CompilerWrapper() def tearDown(self): + super().tearDown() sys.platform = self._backup_platform sysconfig.get_config_var = self._backup_get_config_var sysconfig.get_config_vars = self._backup_get_config_vars @@ -237,6 +241,7 @@ class UnixCCompilerTestCase(unittest.TestCase): # ensure that setting output_dir does not raise # FileNotFoundError: [Errno 2] No such file or directory: 'a.out' self.cc.output_dir = 'scratch' + os.chdir(self.mkdtemp()) self.cc.has_function('abort', includes=['stdlib.h']) diff --git a/setuptools/dist.py b/setuptools/dist.py index fb16886..74afa98 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -145,9 +145,12 @@ def read_pkg_file(self, file): def single_line(val): - # quick and dirty validation for description pypa/setuptools#1390 + """ + Quick and dirty validation for Summary pypa/setuptools#1390. + """ if '\n' in val: - # TODO after 2021-07-31: Replace with `raise ValueError("newlines not allowed")` + # TODO: Replace with `raise ValueError("newlines not allowed")` + # after reviewing #2893. warnings.warn("newlines not allowed and will break in the future") val = val.strip().split('\n')[0] return val -- 2.34.1