From 30b7331b07fbc404959cb37ac311afdfb90813be Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 19 Aug 2024 16:11:46 -0400 Subject: [PATCH] Ensure a missing target is still indicated as 'sources are newer' even when there are no sources. Closes pypa/distutils#284 --- distutils/_modified.py | 2 +- distutils/tests/test_modified.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/distutils/_modified.py b/distutils/_modified.py index 6532aa1073..b7bdaa2943 100644 --- a/distutils/_modified.py +++ b/distutils/_modified.py @@ -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) ) diff --git a/distutils/tests/test_modified.py b/distutils/tests/test_modified.py index 4f1a7caf9a..e35cec2d6f 100644 --- a/distutils/tests/test_modified.py +++ b/distutils/tests/test_modified.py @@ -119,7 +119,6 @@ def test_newer_pairwise_group(groups_target): assert newer == ([groups_target.newer], [groups_target.target]) -@pytest.mark.xfail(reason="pypa/distutils#284") def test_newer_group_no_sources_no_target(tmp_path): """ Consider no sources and no target "newer".