Skip to content
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

Shorten copyright notice at the top of each file #389

Merged

Conversation

Timmmm
Copy link
Collaborator

@Timmmm Timmmm commented Jan 15, 2024

I also collated all the authors from the files and from git history and alphabetised them.

Fixes #358

This script was used to do the modification:

from pathlib import Path
import re

RE_LINE = r"/\*={50,150}\*/\n"
RE_MIDDLE = r"/\*.*\*/\n"

NEW_TEXT = """/*=======================================================================================*/
/*  This Sail RISC-V architecture model, comprising all files and                        */
/*  directories except where otherwise noted is subject the BSD                          */
/*  two-clause license in the LICENSE file.                                              */
/*                                                                                       */
/*  SPDX-License-Identifier: BSD-2-Clause                                                */
/*=======================================================================================*/
"""

REPLACEMENT = re.compile(rf"^{RE_LINE}(?:{RE_MIDDLE}){{10,100}}{RE_LINE}")

def main():
    for file in Path("model").glob("**/*.sail"):
        text = file.read_text(encoding="utf-8")
        text = REPLACEMENT.sub(NEW_TEXT, text, 1)
        file.write_text(text, encoding="utf-8")

if __name__ == "__main__":
    main()

Copy link

github-actions bot commented Jan 15, 2024

Test Results

712 tests  ±0   712 ✅ ±0   0s ⏱️ ±0s
  6 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit b5f67e4. ± Comparison against base commit 4de2bff.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@arichardson arichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a big improvement over copy-pasting the author list to every new file.

LICENCE Outdated Show resolved Hide resolved
LICENCE Outdated Show resolved Hide resolved
LICENCE Show resolved Hide resolved
LICENCE Outdated Show resolved Hide resolved
@Timmmm Timmmm force-pushed the user/timh/shorter_copyright branch from f0297e4 to d17549c Compare February 7, 2024 11:34
@Timmmm
Copy link
Collaborator Author

Timmmm commented Feb 7, 2024

Rebased and added Google. @billmcspadden-riscv is it ok to merge this? It would make it a lot more pleasant to work on the code!

@jrtc27
Copy link
Collaborator

jrtc27 commented Feb 7, 2024

You haven’t integrated Alex’s review comments

@Timmmm Timmmm force-pushed the user/timh/shorter_copyright branch from d17549c to ced4040 Compare February 7, 2024 17:39
@Timmmm
Copy link
Collaborator Author

Timmmm commented Feb 7, 2024

Ooops not sure what happened there. Should be fixed now. I also updated the year to 2024.

Copy link
Collaborator

@arichardson arichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a huge improvement. Would be good to get this merged soon to avoid it being copy-pasted into more new files.

@jrtc27
Copy link
Collaborator

jrtc27 commented Feb 7, 2024

Ooops not sure what happened there. Should be fixed now. I also updated the year to 2024.

Still not done

This script was used to do the modification:

```
from pathlib import Path
import re

RE_LINE = r"/\*={50,150}\*/\n"
RE_MIDDLE = r"/\*.*\*/\n"

NEW_TEXT = """/*=======================================================================================*/
/*  This Sail RISC-V architecture model, comprising all files and                        */
/*  directories except where otherwise noted is subject the BSD                          */
/*  two-clause license in the LICENSE file.                                              */
/*                                                                                       */
/*  SPDX-License-Identifier: BSD-2-Clause                                                */
/*=======================================================================================*/
"""

REPLACEMENT = re.compile(rf"^{RE_LINE}(?:{RE_MIDDLE}){{10,100}}{RE_LINE}")

def main():
    for file in Path("model").glob("**/*.sail"):
        text = file.read_text(encoding="utf-8")
        text = REPLACEMENT.sub(NEW_TEXT, text, 1)
        file.write_text(text, encoding="utf-8")

if __name__ == "__main__":
    main()
```
@Timmmm Timmmm force-pushed the user/timh/shorter_copyright branch from ced4040 to b5f67e4 Compare February 8, 2024 09:42
@Timmmm
Copy link
Collaborator Author

Timmmm commented Feb 8, 2024

Still not done

Oops sorry - I promise that wasn't intentional! 😬 I just suck at copy & pasting apparently.

Copy link
Collaborator

@jrtc27 jrtc27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handful of representatives I was checking had been deleted all seem gone now, thanks

@billmcspadden-riscv billmcspadden-riscv merged commit 2eb3e3d into riscv:master Feb 9, 2024
2 checks passed
@Timmmm Timmmm deleted the user/timh/shorter_copyright branch February 12, 2024 14:20
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

Successfully merging this pull request may close these issues.

Remove copyright headers from every single file
4 participants