From 55885d9053158e9ca721ee490334ff62fcb1c436 Mon Sep 17 00:00:00 2001 From: Carmen Bianca BAKKER Date: Mon, 8 Jul 2024 10:58:45 +0200 Subject: [PATCH 1/2] Be more lenient in ignoring LICENSE and COPYING-like files Also ignore such files separated by a dash instead of a full stop. Also ignore the UK spelling LICENCE. Signed-off-by: Carmen Bianca BAKKER --- src/reuse/__init__.py | 5 +++-- tests/test_project.py | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/reuse/__init__.py b/src/reuse/__init__.py index 7b98506c0..9bd35c2fb 100644 --- a/src/reuse/__init__.py +++ b/src/reuse/__init__.py @@ -64,8 +64,9 @@ ] _IGNORE_FILE_PATTERNS = [ - re.compile(r"^LICENSE(\..*)?$"), - re.compile(r"^COPYING(\..*)?$"), + # LICENSE, LICENSE-MIT, LICENSE.txt + re.compile(r"^LICEN[CS]E([-\.].*)?$"), + re.compile(r"^COPYING([-\.].*)?$"), # ".git" as file happens in submodules re.compile(r"^\.git$"), re.compile(r"^\.gitkeep$"), diff --git a/tests/test_project.py b/tests/test_project.py index 0041466ea..a7196eeac 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -112,13 +112,23 @@ def test_all_files_ignore_hg(empty_directory): def test_all_files_ignore_license_copying(empty_directory): - """When there are files names LICENSE, LICENSE.ext, COPYING, or COPYING.ext, - ignore them. + """When there are files named LICENSE, LICENSE.ext, LICENSE-MIT, COPYING, + COPYING.ext, or COPYING-MIT, ignore them. """ (empty_directory / "LICENSE").write_text("foo") (empty_directory / "LICENSE.txt").write_text("foo") + (empty_directory / "LICENSE-MIT").write_text("foo") (empty_directory / "COPYING").write_text("foo") (empty_directory / "COPYING.txt").write_text("foo") + (empty_directory / "COPYING-MIT").write_text("foo") + + project = Project.from_directory(empty_directory) + assert not list(project.all_files()) + + +def test_all_files_ignore_uk_license(empty_directory): + """Ignore UK spelling of licence.""" + (empty_directory / "LICENCE").write_text("foo") project = Project.from_directory(empty_directory) assert not list(project.all_files()) From 03f793843ac3ff76a1540fda35253377a78d0dac Mon Sep 17 00:00:00 2001 From: Carmen Bianca BAKKER Date: Mon, 8 Jul 2024 11:38:48 +0200 Subject: [PATCH 2/2] Add change log entry Signed-off-by: Carmen Bianca BAKKER --- changelog.d/changed/unspecly-changes.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog.d/changed/unspecly-changes.md diff --git a/changelog.d/changed/unspecly-changes.md b/changelog.d/changed/unspecly-changes.md new file mode 100644 index 000000000..8c8e85d58 --- /dev/null +++ b/changelog.d/changed/unspecly-changes.md @@ -0,0 +1,6 @@ +- Changes that are not strictly compatible with + [REUSE Specification v3.2](https://reuse.software/spec-3.2): + - More `LICENSE` and `COPYING`-like files are ignored. Now, such files + suffixed by `-anything` are also ignored, typically something like + `LICENSE-MIT`. Files with the UK spelling `LICENCE` are also ignored. + (#1041)