Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
36448048
Commit
36448048
authored
1 year ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Scripts - update_license_headers.py:
- Code cleanup - Not finished
parent
d70cdd05
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!235
Release TeraFlowSDN 3.0
,
!224
Resolve "Update license headers for Release 3"
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/update_license_headers.py
+1
-10
1 addition, 10 deletions
scripts/update_license_headers.py
with
1 addition
and
10 deletions
scripts/update_license_headers.py
+
1
−
10
View file @
36448048
...
@@ -27,6 +27,7 @@ FILE_PATH_SKIPPED = 'out-skipped.txt'
...
@@ -27,6 +27,7 @@ FILE_PATH_SKIPPED = 'out-skipped.txt'
FILE_PATH_NO_HEADER
=
'
out-no-header.txt
'
FILE_PATH_NO_HEADER
=
'
out-no-header.txt
'
FILE_PATH_UPDATED
=
'
out-updated.txt
'
FILE_PATH_UPDATED
=
'
out-updated.txt
'
STR_NEW_COPYRIGHT
=
'
Copyright 2022-2024 ETSI TeraFlowSDN - TFS OSG/SDG (https://tfs.etsi.org/)
'
RE_OLD_COPYRIGHTS
=
[
RE_OLD_COPYRIGHTS
=
[
r
'
Copyright\ 2021\-2023\ H2020\ TeraFlow\ \(https\:\/\/www\.teraflow\-h2020\.eu\/\)
'
,
r
'
Copyright\ 2021\-2023\ H2020\ TeraFlow\ \(https\:\/\/www\.teraflow\-h2020\.eu\/\)
'
,
r
'
Copyright\ 2022\-2023\ ETSI\ TeraFlowSDN\ \-\ TFS\ OSG\ \(https\:\/\/tfs\.etsi\.org\/\)
'
,
r
'
Copyright\ 2022\-2023\ ETSI\ TeraFlowSDN\ \-\ TFS\ OSG\ \(https\:\/\/tfs\.etsi\.org\/\)
'
,
...
@@ -36,8 +37,6 @@ RE_OLD_COPYRIGHTS = [
...
@@ -36,8 +37,6 @@ RE_OLD_COPYRIGHTS = [
for
re_old_copyright
in
RE_OLD_COPYRIGHTS
for
re_old_copyright
in
RE_OLD_COPYRIGHTS
]
]
STR_NEW_COPYRIGHT
=
'
Copyright 2022-2024 ETSI TeraFlowSDN - TFS OSG/SDG (https://tfs.etsi.org/)
'
def
skip_file
(
file_path
:
str
)
->
bool
:
def
skip_file
(
file_path
:
str
)
->
bool
:
if
os
.
path
.
islink
(
file_path
):
return
True
if
os
.
path
.
islink
(
file_path
):
return
True
if
file_path
.
endswith
(
'
.pyc
'
):
return
True
if
file_path
.
endswith
(
'
.pyc
'
):
return
True
...
@@ -80,16 +79,10 @@ def skip_file(file_path : str) -> bool:
...
@@ -80,16 +79,10 @@ def skip_file(file_path : str) -> bool:
return
False
return
False
def
process_line
(
line_in
:
str
)
->
str
:
def
process_line
(
line_in
:
str
)
->
str
:
print
(
'
line_in
'
,
line_in
)
for
re_match
,
re_sub
in
RE_OLD_COPYRIGHTS
:
for
re_match
,
re_sub
in
RE_OLD_COPYRIGHTS
:
print
(
'
re_match
'
,
re_match
)
print
(
'
re_sub
'
,
re_sub
)
match
=
re_match
.
match
(
line_in
)
match
=
re_match
.
match
(
line_in
)
print
(
'
match
'
,
match
)
if
match
is
None
:
continue
if
match
is
None
:
continue
print
(
'
matched!
'
)
line_out
=
re_sub
.
sub
(
STR_NEW_COPYRIGHT
,
line_in
)
line_out
=
re_sub
.
sub
(
STR_NEW_COPYRIGHT
,
line_in
)
print
(
'
line_out
'
,
line_out
)
return
line_out
return
line_out
return
line_in
return
line_in
...
@@ -123,8 +116,6 @@ def process_file(
...
@@ -123,8 +116,6 @@ def process_file(
os
.
rename
(
temp_file_path
,
file_path
)
os
.
rename
(
temp_file_path
,
file_path
)
os
.
chmod
(
file_path
,
file_stat
.
st_mode
)
os
.
chmod
(
file_path
,
file_stat
.
st_mode
)
raise
Exception
()
def
main
()
->
int
:
def
main
()
->
int
:
with
open
(
FILE_PATH_NO_HEADER
,
'
w
'
,
encoding
=
'
UTF-8
'
)
as
file_no_header
:
with
open
(
FILE_PATH_NO_HEADER
,
'
w
'
,
encoding
=
'
UTF-8
'
)
as
file_no_header
:
with
open
(
FILE_PATH_SKIPPED
,
'
w
'
,
encoding
=
'
UTF-8
'
)
as
file_skipped
:
with
open
(
FILE_PATH_SKIPPED
,
'
w
'
,
encoding
=
'
UTF-8
'
)
as
file_skipped
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment