-
Notifications
You must be signed in to change notification settings - Fork 17
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 in to your account
Directive to include code without license header #20
Conversation
Could you add a demo / test in the documentation somewhere? |
Currently, there is no difference in using |
When we merge this, we need to arrange the commits so that the patch for |
sphinxcontrib_verilog_diagrams.py
Outdated
rel_filename, filename = self.env.relfn2path(self.arguments[0]) | ||
code = open(rel_filename, 'r').read().strip().split('\n') | ||
first_line = next( | ||
(idx + 3 for idx, line in enumerate(code) if 'SPDX' in line), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, this assumes that the license header is in the C-style multiline comment format, with a newline after the comment, hence the idx + 3
. For example
/*
* Copyright (C) 2020 The SymbiFlow Authors.
*
* Use of this source code is governed by a ISC-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/ISC
*
* SPDX-License-Identifier: ISC
*/
In the python files there will not be an extra line ending the comment (the */
line), and might not have a newline after the header (for example I see this in chipsalliance/fasm@5d25dc7). Since this is the verilog-diagrams extension, should we for now just narrow our use case to our verilog code which supposedly fits these assumptions, and not worry about the other languages (for example python)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verilog supports both /*
and //
style comments IIRC, so we should at least support them.
FYI - You need to rebase this. |
Rebased and changed to determine starting line based on type of comment used |
Could you rebase this, then I'll merge? |
This is implemented in the `no-license` directive, which has the exact same usage and options as `literalinclude`. Only difference is the `lines` options is set to start after the license header and to end at the last line of the file. The end of the license header is detected by searching for the line that contains the SPDX identifier. Therefore this directive assumes that the license header contains the SPDX identifier. Signed-off-by: Daniel Lim Wee Soong <weesoong.lim@gmail.com>
Signed-off-by: Daniel Lim Wee Soong <weesoong.lim@gmail.com>
- The link from README.md to the docs is broken. - Add a link from the docs to the GitHub repo. Signed-off-by: Daniel Lim Wee Soong <weesoong.lim@gmail.com>
Signed-off-by: Daniel Lim Wee Soong <weesoong.lim@gmail.com>
Ok done. |
This is implemented in the
no-license
directive, which has the exact same usage and options asliteralinclude
. Only difference is thelines
options is set to start after the license header and to end at the last line of the file.The end of the license header is detected by searching for the line that contains the SPDX identifier. Therefore this directive assumes that the license header contains the SPDX identifier.
I’m not sure how to name it :P.
no-license
sounds weird whileno-license-include
is so long. Running out of ideas.Resolve chipsalliance/f4pga-v2x#47
Signed-off-by: Daniel Lim Wee Soong weesoong.lim@gmail.com