From: JinWang An Date: Mon, 27 Mar 2023 08:02:59 +0000 (+0900) Subject: Imported Upstream version 66.1.1 X-Git-Tag: upstream/66.1.1^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7dc322058fb53daf3a6b5b2fb12d81789476fbf;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 66.1.1 --- diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d997ebc..53f735f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 66.1.0 +current_version = 66.1.1 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 7a9d817..fc92c8c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,13 @@ +v66.1.1 +------- + + +Misc +^^^^ +* #3782: Fixed problem with ``file`` directive in ``tool.setuptools.dynamic`` + (``pyproject.toml``) when value is a simple string instead of list. + + v66.1.0 ------- diff --git a/setup.cfg b/setup.cfg index 04d88d3..0cededb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = setuptools -version = 66.1.0 +version = 66.1.1 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py index cedf567..9ce5502 100644 --- a/setuptools/config/pyprojecttoml.py +++ b/setuptools/config/pyprojecttoml.py @@ -309,10 +309,12 @@ class _ConfigExpander: def _expand_directive( self, specifier: str, directive, package_dir: Mapping[str, str] ): + from setuptools.extern.more_itertools import always_iterable # type: ignore + with _ignore_errors(self.ignore_option_errors): root_dir = self.root_dir if "file" in directive: - self._referenced_files.update(directive["file"]) + self._referenced_files.update(always_iterable(directive["file"])) return _expand.read_files(directive["file"], root_dir) if "attr" in directive: return _expand.read_attr(directive["attr"], package_dir, root_dir) diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py index 11de75c..117c077 100644 --- a/setuptools/tests/test_sdist.py +++ b/setuptools/tests/test_sdist.py @@ -502,7 +502,7 @@ class TestSdistTest: "setup.cfg - long_description and version": """ [metadata] name = testing - version = file: VERSION.txt + version = file: src/VERSION.txt license_files = DOWHATYOUWANT long_description = file: README.rst, USAGE.rst """, @@ -513,7 +513,16 @@ class TestSdistTest: license = {file = "DOWHATYOUWANT"} dynamic = ["version"] [tool.setuptools.dynamic] - version = {file = ["VERSION.txt"]} + version = {file = ["src/VERSION.txt"]} + """, + "pyproject.toml - directive with str instead of list": """ + [project] + name = "testing" + readme = "USAGE.rst" + license = {file = "DOWHATYOUWANT"} + dynamic = ["version"] + [tool.setuptools.dynamic] + version = {file = "src/VERSION.txt"} """ } @@ -521,7 +530,8 @@ class TestSdistTest: def test_add_files_referenced_by_config_directives(self, tmp_path, config): config_file, _, _ = config.partition(" - ") config_text = self._EXAMPLE_DIRECTIVES[config] - (tmp_path / 'VERSION.txt').write_text("0.42", encoding="utf-8") + (tmp_path / 'src').mkdir() + (tmp_path / 'src/VERSION.txt').write_text("0.42", encoding="utf-8") (tmp_path / 'README.rst').write_text("hello world!", encoding="utf-8") (tmp_path / 'USAGE.rst').write_text("hello world!", encoding="utf-8") (tmp_path / 'DOWHATYOUWANT').write_text("hello world!", encoding="utf-8") @@ -536,9 +546,14 @@ class TestSdistTest: with quiet(): cmd.run() - assert 'VERSION.txt' in cmd.filelist.files + assert ( + 'src/VERSION.txt' in cmd.filelist.files + or 'src\\VERSION.txt' in cmd.filelist.files + ) assert 'USAGE.rst' in cmd.filelist.files assert 'DOWHATYOUWANT' in cmd.filelist.files + assert '/' not in cmd.filelist.files + assert '\\' not in cmd.filelist.files def test_pyproject_toml_in_sdist(self, tmpdir): """