|
1 | 1 | import shutil |
| 2 | +import textwrap |
2 | 3 | from pathlib import Path |
3 | 4 |
|
4 | 5 | import tomlkit |
|
69 | 70 | 'https://gitlab.cern.ch/acc-co/devops/python/prototypes/simple-pypi-frontend', |
70 | 71 | 'https://github.com/simple-repository/simple-repository-browser', |
71 | 72 | ) |
| 73 | + |
| 74 | + content = textwrap.dedent('''\ |
| 75 | + {# |
| 76 | + Copyright (C) 2023, CERN |
| 77 | + This software is distributed under the terms of the MIT |
| 78 | + licence, copied verbatim in the file "LICENSE". |
| 79 | + In applying this license, CERN does not waive the privileges and immunities |
| 80 | + granted to it by virtue of its status as Intergovernmental Organization |
| 81 | + or submit itself to any jurisdiction. |
| 82 | + #}\n |
| 83 | + ''') + content |
| 84 | + |
72 | 85 | file.write_text(content) |
| 86 | + |
| 87 | +hash_comment_files = ( |
| 88 | + list(build.glob('**/*.py')) + list(build.glob('**/*.toml')) |
| 89 | +) |
| 90 | +for path in hash_comment_files: |
| 91 | + if not path.is_file(): |
| 92 | + continue |
| 93 | + content = path.read_text() |
| 94 | + content = '\n'.join([ |
| 95 | + '# Copyright (C) 2023, CERN', |
| 96 | + '# This software is distributed under the terms of the MIT', |
| 97 | + '# licence, copied verbatim in the file "LICENSE".', |
| 98 | + '# In applying this license, CERN does not waive the privileges and immunities', |
| 99 | + '# granted to it by virtue of its status as Intergovernmental Organization', |
| 100 | + '# or submit itself to any jurisdiction.', |
| 101 | + '', |
| 102 | + ]) + '\n' + content.lstrip() |
| 103 | + content = content.rstrip() + '\n' |
| 104 | + path.write_text(content, 'utf-8') |
0 commit comments