Skip to content

Commit

Permalink
Merge https://github.com/pypa/distutils into bugfix/distutils-284
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 19, 2024
2 parents 8bd9308 + 30b7331 commit ad611bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/+61911d95.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Synced with pypa/distutils@30b7331 including fix for modified check on empty sources (pypa/distutils#284).
2 changes: 1 addition & 1 deletion setuptools/_distutils/_modified.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def missing_as_newer(source):
return missing == 'newer' and not os.path.exists(source)

ignored = os.path.exists if missing == 'ignore' else None
return any(
return not os.path.exists(target) or any(
missing_as_newer(source) or _newer(source, target)
for source in filter(ignored, sources)
)
Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def _show_help(
)
print()

for command in self.commands:
for command in commands:
if isinstance(command, type) and issubclass(command, Command):
klass = command
else:
Expand Down
7 changes: 7 additions & 0 deletions setuptools/_distutils/tests/test_modified.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,10 @@ def test_newer_pairwise_group(groups_target):
newer = newer_pairwise_group([groups_target.newer], [groups_target.target])
assert older == ([], [])
assert newer == ([groups_target.newer], [groups_target.target])


def test_newer_group_no_sources_no_target(tmp_path):
"""
Consider no sources and no target "newer".
"""
assert newer_group([], str(tmp_path / 'does-not-exist'))

0 comments on commit ad611bc

Please sign in to comment.