IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
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
Antonio Augusto Alves Junior
corsika
Commits
8deeac94
Commit
8deeac94
authored
5 years ago
by
ralfulrich
Browse files
Options
Downloads
Patches
Plain Diff
fixed script
parent
85558652
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
do-copyright.py
+21
-11
21 additions, 11 deletions
do-copyright.py
with
21 additions
and
11 deletions
do-copyright.py
+
21
−
11
View file @
8deeac94
...
@@ -16,7 +16,7 @@ text = """
...
@@ -16,7 +16,7 @@ text = """
* This software is distributed under the terms of the GNU General Public
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
* the license.
*/
*/
\n
"""
"""
Debug
=
0
# 0: nothing, 1: checking, 2: filesystem
Debug
=
0
# 0: nothing, 1: checking, 2: filesystem
...
@@ -29,10 +29,13 @@ extensions = [".cc", ".h", ".test"]
...
@@ -29,10 +29,13 @@ extensions = [".cc", ".h", ".test"]
justCheck
=
True
# T: only checking, F: also changing files
justCheck
=
True
# T: only checking, F: also changing files
foundMissing
=
False
foundMissing
=
False
forYear
=
"
YEAR
"
# replace this with year via command line
###############################################
###############################################
#
#
def
checkNote
(
filename
):
def
checkNote
(
filename
):
global
foundMissing
,
justCheck
global
foundMissing
,
justCheck
,
forYear
if
Debug
>
0
:
if
Debug
>
0
:
print
(
"
***********************************************
"
)
print
(
"
***********************************************
"
)
...
@@ -92,8 +95,10 @@ def checkNote(filename):
...
@@ -92,8 +95,10 @@ def checkNote(filename):
if
isSame
and
len
(
startNote
)
<=
1
:
if
isSame
and
len
(
startNote
)
<=
1
:
return
return
print
(
"
No copyright note in file:
"
+
filename
)
if
(
len
(
startNote
)
==
0
):
print
(
"
No copyright note in file:
"
+
filename
)
# either we found a file with no copyright, or with wrong copyright notice here
if
justCheck
:
if
justCheck
:
foundMissing
=
True
foundMissing
=
True
return
return
...
@@ -104,8 +109,9 @@ def checkNote(filename):
...
@@ -104,8 +109,9 @@ def checkNote(filename):
with
open
(
filename
,
"
w
"
)
as
file
:
with
open
(
filename
,
"
w
"
)
as
file
:
file
.
write
(
text
)
textReplace
=
re
.
sub
(
r
"
Copyright YEAR
"
,
"
Copyright
"
+
forYear
+
"
"
,
text
)
file
.
write
(
textReplace
)
skip
=
False
skip
=
False
for
iLine
in
range
(
len
(
lines
)):
for
iLine
in
range
(
len
(
lines
)):
...
@@ -130,7 +136,9 @@ def checkNote(filename):
...
@@ -130,7 +136,9 @@ def checkNote(filename):
###############################################
###############################################
#
#
#def next_file(x, dir_name, files):
# check files: loops over list of files,
# excludes if wished, process otherwise
#
def
next_file
(
dir_name
,
files
):
def
next_file
(
dir_name
,
files
):
for
check
in
excludeDirs
:
for
check
in
excludeDirs
:
if
check
in
dir_name
:
if
check
in
dir_name
:
...
@@ -161,22 +169,24 @@ def next_file(dir_name, files):
...
@@ -161,22 +169,24 @@ def next_file(dir_name, files):
###############################################
###############################################
# the main program
# the main program
def
main
(
argv
):
def
main
(
argv
):
global
justCheck
,
foundMissing
,
Debug
global
justCheck
,
foundMissing
,
Debug
,
forYear
justCheck
=
True
justCheck
=
True
Debug
=
0
Debug
=
0
try
:
try
:
opts
,
args
=
getopt
.
getopt
(
argv
,
"
c
I
hd:
"
,
[
"
check
"
,
"
implement
"
,
"
debug=
"
])
opts
,
args
=
getopt
.
getopt
(
argv
,
"
c
A
hd:
"
,
[
"
check
"
,
"
add=
"
,
"
debug=
"
])
except
getopt
.
GetoptError
:
except
getopt
.
GetoptError
:
print
'
do-copyright.py [--check] [--
implement
] [--debug=0]
'
print
'
do-copyright.py [--check] [--
add=YEAR
] [--debug=0]
'
sys
.
exit
(
2
)
sys
.
exit
(
2
)
for
opt
,
arg
in
opts
:
for
opt
,
arg
in
opts
:
if
opt
==
'
-h
'
:
if
opt
==
'
-h
'
:
print
'
do-copyright.py [--check] [--
implement
] [--debug=0]
'
print
'
do-copyright.py [--check] [--
add=YEAR
] [--debug=0]
'
sys
.
exit
()
sys
.
exit
()
elif
opt
in
(
"
-c
"
,
"
--check
"
):
elif
opt
in
(
"
-c
"
,
"
--check
"
):
justCheck
=
True
justCheck
=
True
elif
opt
in
(
"
-
I
"
,
"
--
implement
"
):
elif
opt
in
(
"
-
A
"
,
"
--
add
"
):
justCheck
=
False
justCheck
=
False
forYear
=
str
(
arg
)
print
'
Adding
\'
Copyright
'
+
forYear
+
'
\'
notice, where needed.
'
elif
opt
in
(
"
-d
"
,
"
--debug
"
):
elif
opt
in
(
"
-d
"
,
"
--debug
"
):
Debug
=
int
(
arg
)
Debug
=
int
(
arg
)
...
...
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