Skip to content

Commit 2ad8c10

Browse files
authored
Merge pull request #4576 from pypa/bugfix/distutils-284
Sync with distutils@30b7331
2 parents 8afe0c3 + ad611bc commit 2ad8c10

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

newsfragments/+61911d95.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Synced with pypa/distutils@30b7331 including fix for modified check on empty sources (pypa/distutils#284).

setuptools/_distutils/_modified.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def missing_as_newer(source):
6363
return missing == 'newer' and not os.path.exists(source)
6464

6565
ignored = os.path.exists if missing == 'ignore' else None
66-
return any(
66+
return not os.path.exists(target) or any(
6767
missing_as_newer(source) or _newer(source, target)
6868
for source in filter(ignored, sources)
6969
)

setuptools/_distutils/dist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ def _show_help(
658658
)
659659
print()
660660

661-
for command in self.commands:
661+
for command in commands:
662662
if isinstance(command, type) and issubclass(command, Command):
663663
klass = command
664664
else:

setuptools/_distutils/tests/test_modified.py

+7
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,10 @@ def test_newer_pairwise_group(groups_target):
117117
newer = newer_pairwise_group([groups_target.newer], [groups_target.target])
118118
assert older == ([], [])
119119
assert newer == ([groups_target.newer], [groups_target.target])
120+
121+
122+
def test_newer_group_no_sources_no_target(tmp_path):
123+
"""
124+
Consider no sources and no target "newer".
125+
"""
126+
assert newer_group([], str(tmp_path / 'does-not-exist'))

0 commit comments

Comments
 (0)