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) diff --git a/src/reuse/__init__.py b/src/reuse/__init__.py index a08f14266..7325e9a71 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"^\.hgtags$"), diff --git a/tests/test_project.py b/tests/test_project.py index ea3ad7ae5..b590aa1bc 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -113,13 +113,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())