From 5895f3682ba09ced994fd3be714ab4b4598e4e58 Mon Sep 17 00:00:00 2001 From: Anthony Loiseau Date: Fri, 2 Jun 2023 11:52:30 +0200 Subject: [PATCH 1/2] Add a set of Qt file types (pri, qrc, qss, ui) Add few more Qt-related file extensions to known ones: .pri: They are very closed to .pro files. Unfortunately .pri can also refers to binary files in Window app context, hence it is added as Uncommentable. .qrc: Those are Qt XML files containing indexes to resource files. Added as Uncommentable because Qt Creator IDE rewrites the file when saving, loosing copyrights each time therefore loosing history. .qss: Qt Style Sheet, based on CSS file format. .ui: Qt user interface definition file, XML. Added as Uncommentable because ui files are overwritten by Qt Creator upon saving which looses copyright history. Signed-off-by: Anthony Loiseau --- CHANGELOG.md | 4 ++++ src/reuse/comment.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7c6c97c1..b0fd762c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,10 @@ CLI command and its behaviour. There are no guarantees of stability for the - Fennel (`.fnl`) (#638) - CommonJS (`.cjs`) (#632) - Qt .pro (`.pro`) (#632) + - Qt .pri (`.pri`) (#755) + - Qt .qrc (`.qrc`) (#755) + - Qt .qss(`.qss`) (#755) + - Qt .ui (`.ui`) (#755) - Textile (`.textile`) (#712) - Visual Studio Code workspace (`.code-workspace`) (#747) - Application Resource Bundle (`.arb`) (#749) diff --git a/src/reuse/comment.py b/src/reuse/comment.py index a140b8ef4..64cbe562c 100644 --- a/src/reuse/comment.py +++ b/src/reuse/comment.py @@ -626,6 +626,7 @@ class XQueryCommentStyle(CommentStyle): ".pot": PythonCommentStyle, ".ppt": UncommentableCommentStyle, ".pptx": UncommentableCommentStyle, + ".pri": UncommentableCommentStyle, ".pro": PythonCommentStyle, ".proto": CCommentStyle, ".ps1": PythonCommentStyle, # TODO: Multiline comments @@ -639,6 +640,8 @@ class XQueryCommentStyle(CommentStyle): ".pyx": PythonCommentStyle, ".qbs": CCommentStyle, ".qml": CCommentStyle, + ".qrc": UncommentableCommentStyle, + ".qss": CssCommentStyle, ".R": PythonCommentStyle, ".rake": PythonCommentStyle, ".rb": PythonCommentStyle, @@ -676,6 +679,7 @@ class XQueryCommentStyle(CommentStyle): ".ts": CCommentStyle, ".tsx": CCommentStyle, ".ttl": PythonCommentStyle, # Turtle/RDF + ".ui": UncommentableCommentStyle, ".v": CCommentStyle, # V-Lang source code ".vala": CCommentStyle, ".vim": VimCommentStyle, From 10bae3daff7f478fa4bc1dd906ad6322f5974a2b Mon Sep 17 00:00:00 2001 From: Anthony Loiseau Date: Mon, 5 Jun 2023 15:00:20 +0200 Subject: [PATCH 2/2] pri files can safely be commented as python files As noted by Carmen Bianca BAKKER within #755 review, reuse automatically creates a .license for binary files ignoring known file extension map. Therefore binary Windows app .pri file is not an issue to mark .pri files as python-like files. I tested with two pri files: one legitimate Qt pri file (text) and one fake binary pri file. Reuse actually did things as expected, injecting license in text pri file and as a separate file for the binary pri file. Attribution: Carmen Bianca BAKKER --- src/reuse/comment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reuse/comment.py b/src/reuse/comment.py index 64cbe562c..63e6e600a 100644 --- a/src/reuse/comment.py +++ b/src/reuse/comment.py @@ -626,7 +626,7 @@ class XQueryCommentStyle(CommentStyle): ".pot": PythonCommentStyle, ".ppt": UncommentableCommentStyle, ".pptx": UncommentableCommentStyle, - ".pri": UncommentableCommentStyle, + ".pri": PythonCommentStyle, ".pro": PythonCommentStyle, ".proto": CCommentStyle, ".ps1": PythonCommentStyle, # TODO: Multiline comments