8000 addheader should recognise file extensions that *require* .license files · Issue #189 · fsfe/reuse-tool · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

addheader should recognise file extensions that *require* .license files #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign 8000 in to your account

Closed
carmenbianca opened this issue Feb 24, 2020 · 5 comments
Closed

Comments

@carmenbianca
Copy link
Member

e.g., .json.

@nicorikken
Copy link
Member

What would be a neat way to achieve this? Can there be a similar map like EXTENSION_COMMENT_STYLE_MAP in src/reuse_comment.py to check against? I notice that currently .sqlite and .whl files are already handled in a different way, but I'm not able to find out how that works.

@mxmehl
Copy link
Member
mxmehl commented Jan 13, 2021

Regarding your last question, this happens via is_binary from the binaryornot.check module.

I am not sure whether we would come around adding file extensions manually. I am not aware of a list for such files.

@nicorikken
Copy link
Member
nicorikken commented Jan 14, 2021

Alright, looking at the code, it makes sense to have an additional comment style which equates to NoCommentStyle possible. This can be the result of _get_comment_style(path), as is being called in _add_header_to_file() in header.py. So following the execution flow of run() in header.py first the binary files are handled differently, and then plaintext files are handled. And in the process of plaintext files the NoCommentStyle files are then dealt with. Similar to the shortcut in run() in header.py the path variable can be replaced to represent the <filename>.license path, and the execution can then be followed. In this case the style also has to be changed to an EmptyCommentStyle so the correct details are added in the new .license file.

I hope my worded PR is clear enough 😄 Either way I now have an idea how to implement this. But other suggestions are welcome.

@mxmehl
Copy link
Member
mxmehl commented Jan 14, 2021

A better Python programmer than I am would probably understand this better, but I think I can follow your argumentation well enough, thanks :)

oxzi added a commit to oxzi/reuse-tool that referenced this issue Jan 14, 2021
Previously, only binary files were handled as uncommentable [0]. For
other files the "--explicit-license" flag has to be set explicitly.
However, there are also text files which are uncommentable.

This commit / pull request introduces support for a new pseudo comment
style for uncommentable text files.

One use case is, for example, Golang's go.sum file. Hashes of the
referenced modules are listed there, but without any special header [1].
Thus it is not possible to add an SPDX header. However, this file cannot
be omitted. Whether the file is to be ignored license-wise was addressed
in a previous pull request [2], but not clarified.

Another prominent use case might be JSON files, which also cannot
contain comments or headers. This was also discussed before [3].

With the changes introduced here, this file is recognized as
uncommentable and a .license file is created.

[0] https://reuse.software/tutorial/#binary-and-uncommentable-files
[1] https://blog.golang.org/using-go-modules
[2] fsfe#234
[3] fsfe#189
@mxmehl
Copy link
Member
mxmehl commented Jan 15, 2021

Closed with #298, thanks @oxzi!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0