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
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
Pranav Sampathkumar
corsika
Commits
32a54086
Commit
32a54086
authored
5 years ago
by
ralfulrich
Browse files
Options
Downloads
Patches
Plain Diff
python3
parent
c3a267c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
do-copyright.py
+10
-10
10 additions, 10 deletions
do-copyright.py
with
10 additions
and
10 deletions
do-copyright.py
+
10
−
10
View file @
32a54086
#!/usr/bin/python
#!/usr/bin/
env
python
3
import
os
import
os
import
sys
,
getopt
import
sys
,
getopt
...
@@ -69,9 +69,9 @@ def checkNote(filename):
...
@@ -69,9 +69,9 @@ def checkNote(filename):
if
Debug
>
0
:
if
Debug
>
0
:
txt
=
"
states: n=
"
+
str
(
len
(
startNote
))
txt
=
"
states: n=
"
+
str
(
len
(
startNote
))
for
i
in
x
range
(
len
(
startNote
)):
for
i
in
range
(
len
(
startNote
)):
txt
+=
"
, [
"
+
str
(
startNote
[
i
])
+
"
-
"
+
str
(
endNote
[
i
])
+
"
]
"
txt
+=
"
, [
"
+
str
(
startNote
[
i
])
+
"
-
"
+
str
(
endNote
[
i
])
+
"
]
"
print
(
"
stats:
"
)
+
txt
print
(
"
stats:
"
+
txt
)
# now check if first copyright notices is already identical...
# now check if first copyright notices is already identical...
isSame
=
False
isSame
=
False
...
@@ -86,7 +86,7 @@ def checkNote(filename):
...
@@ -86,7 +86,7 @@ def checkNote(filename):
if
not
re
.
match
(
regex
,
lines
[
startNote
[
0
]
+
iLine
].
strip
(
"
\n
"
)):
if
not
re
.
match
(
regex
,
lines
[
startNote
[
0
]
+
iLine
].
strip
(
"
\n
"
)):
isSame
=
False
isSame
=
False
foundMissing
=
True
foundMissing
=
True
print
"
needs update:
"
+
filename
+
"
new=
\'
"
+
noteLines
[
iLine
+
1
]
+
"
\'
vs old=
\'
"
+
lines
[
startNote
[
0
]
+
iLine
].
rstrip
(
'
\n
'
)
+
"
\'
"
print
(
"
needs update:
"
+
filename
+
"
new=
\'
"
+
noteLines
[
iLine
+
1
]
+
"
\'
vs old=
\'
"
+
lines
[
startNote
[
0
]
+
iLine
].
rstrip
(
'
\n
'
)
+
"
\'
"
)
break
break
if
Debug
>
0
:
if
Debug
>
0
:
print
(
"
isSame=
"
+
str
(
isSame
)
+
"
"
+
str
(
len
(
startNote
)))
print
(
"
isSame=
"
+
str
(
isSame
)
+
"
"
+
str
(
len
(
startNote
)))
...
@@ -118,7 +118,7 @@ def checkNote(filename):
...
@@ -118,7 +118,7 @@ def checkNote(filename):
inBlock
=
False
inBlock
=
False
for
iBlock
in
range
(
len
(
startNote
)):
for
iBlock
in
range
(
len
(
startNote
)):
if
iLine
>=
startNote
[
iBlock
]
and
iLine
<=
endNote
[
iBlock
]:
if
iLine
>=
startNote
[
iBlock
]
and
iLine
<=
endNote
[
iBlock
]:
print
"
[remove
"
+
str
(
iBlock
)
+
"
]
"
+
(
lines
[
iLine
]).
strip
()
print
(
"
[remove
"
+
str
(
iBlock
)
+
"
]
"
+
(
lines
[
iLine
]).
strip
()
)
inBlock
=
True
inBlock
=
True
skip
=
True
skip
=
True
...
@@ -175,23 +175,23 @@ def main(argv):
...
@@ -175,23 +175,23 @@ def main(argv):
try
:
try
:
opts
,
args
=
getopt
.
getopt
(
argv
,
"
cAhd:
"
,
[
"
check
"
,
"
add=
"
,
"
debug=
"
])
opts
,
args
=
getopt
.
getopt
(
argv
,
"
cAhd:
"
,
[
"
check
"
,
"
add=
"
,
"
debug=
"
])
except
getopt
.
GetoptError
:
except
getopt
.
GetoptError
:
print
'
do-copyright.py [--check] [--add=YEAR] [--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] [--add=YEAR] [--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
(
"
-A
"
,
"
--add
"
):
elif
opt
in
(
"
-A
"
,
"
--add
"
):
justCheck
=
False
justCheck
=
False
forYear
=
str
(
arg
)
forYear
=
str
(
arg
)
print
'
Adding
\'
Copyright
'
+
forYear
+
'
\'
notice, where needed.
'
print
(
'
Adding
\'
Copyright
'
+
forYear
+
'
\'
notice, where needed.
'
)
elif
opt
in
(
"
-d
"
,
"
--debug
"
):
elif
opt
in
(
"
-d
"
,
"
--debug
"
):
Debug
=
int
(
arg
)
Debug
=
int
(
arg
)
if
justCheck
:
if
justCheck
:
print
'
Only checking. No changes. See
\'
do-copyright.py -h
\'
for options.
'
print
(
'
Only checking. No changes. See
\'
do-copyright.py -h
\'
for options.
'
)
for
root
,
dirs
,
files
in
os
.
walk
(
'
./
'
):
for
root
,
dirs
,
files
in
os
.
walk
(
'
./
'
):
next_file
(
root
,
files
)
next_file
(
root
,
files
)
...
@@ -204,5 +204,5 @@ if __name__ == "__main__":
...
@@ -204,5 +204,5 @@ if __name__ == "__main__":
if
justCheck
and
foundMissing
:
if
justCheck
and
foundMissing
:
sys
.
exit
(
-
1
)
# found error
sys
.
exit
(
-
1
)
# found error
print
"
Finished
"
print
(
"
Finished
"
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
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