Imported Upstream version 66.1.1 upstream/66.1.1
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:59 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:59 +0000 (17:02 +0900)
.bumpversion.cfg
CHANGES.rst
setup.cfg
setuptools/config/pyprojecttoml.py
setuptools/tests/test_sdist.py

index d997ebcd557bd8de890acab590dcebd8d3201393..53f735f0c5b8ff4c896baee2ba2fe7a4a8f3e46d 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 66.1.0
+current_version = 66.1.1
 commit = True
 tag = True
 
index 7a9d81763fc2bf1a687a74cc576d9953a4223fd8..fc92c8c0687e6f3a32789dc6597d2a73ab53010f 100644 (file)
@@ -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
 -------
 
index 04d88d32ce879a96a5faeccdefea27926ccf95c5..0cededb79f1e20c44d0e3cdb2fb5560350046373 100644 (file)
--- 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
index cedf56751f43113d358ab0ff69d27f9cebf58164..9ce550222c9f1ba0733840b55864ce1ffedd74df 100644 (file)
@@ -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)
index 11de75c7bbe84b3af6839ac452f39775000f7d06..117c077269454156c2f71bd1c9eb221e70e48fb8 100644 (file)
@@ -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):
         """