Skip to content

Commit f2bd993

Browse files
committed
Merge branch 'feature/prepare-repo' into 'master'
Update the repo preparation script to include the copyright headers See merge request acc-co/devops/python/package-index/simple-repository-browser!116
2 parents 2dfd382 + 3b72cde commit f2bd993

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

prepare-repo-dump.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import shutil
2+
import textwrap
23
from pathlib import Path
34

45
import tomlkit
@@ -69,4 +70,35 @@
6970
'https://gitlab.cern.ch/acc-co/devops/python/prototypes/simple-pypi-frontend',
7071
'https://github.com/simple-repository/simple-repository-browser',
7172
)
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+
7285
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

Comments
 (0)