Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Charles Burton
Gaudi
Commits
c1e46869
Commit
c1e46869
authored
Nov 28, 2017
by
Alex Pearce
🌈
Committed by
kreczko
Feb 14, 2019
Browse files
Use Python 3 compatible printing and importing.
parent
80a85700
Changes
7
Hide whitespace changes
Inline
Side-by-side
GaudiPolicy/scripts/createProjVersHeader.py
View file @
c1e46869
#!/usr/bin/env python
from
__future__
import
print_function
import
os
import
sys
import
re
...
...
@@ -21,7 +21,7 @@ def main():
project
,
version
,
outputfile
=
args
if
not
opts
.
quiet
:
print
"Creating %s for %s %s"
%
(
outputfile
,
project
,
version
)
print
(
"Creating %s for %s %s"
%
(
outputfile
,
project
,
version
)
)
for
style
in
[
lhcb_ver_style
,
atlas_ver_style
,
plain_ver_style
]:
m
=
re
.
match
(
style
,
version
)
...
...
@@ -38,7 +38,7 @@ def main():
outdir
=
os
.
path
.
dirname
(
outputfile
)
if
not
os
.
path
.
exists
(
outdir
):
if
not
opts
.
quiet
:
print
"Creating directory"
,
outdir
print
(
"Creating directory"
,
outdir
)
os
.
makedirs
(
outdir
)
# Prepare data to be written
...
...
cmake/cmakeLogToCacheGrind.py
View file @
c1e46869
...
...
@@ -5,12 +5,12 @@ Gaudi cmake process (See Instrument.cmake) and create an other file
understandable by kcachegrind for easy visualization of where we spend time in
cmake.
'''
from
__future__
import
print_function
import
sys
def
usage
():
print
"Invalid arguments
\n
Proper syntax is :
\n
%s <log file> <callgrind file>"
%
sys
.
argv
[
0
]
print
(
"Invalid arguments
\n
Proper syntax is :
\n
%s <log file> <callgrind file>"
%
sys
.
argv
[
0
])
if
len
(
sys
.
argv
)
!=
3
:
...
...
@@ -45,7 +45,7 @@ for line in open(sys.argv[1]).readlines():
elif
key
==
'ENDTIME'
:
sfunc
,
stime
=
callStack
.
pop
()
if
sfunc
!=
func
:
print
'Mismatch START/END for %s/%s'
%
(
sfunc
,
func
)
print
(
'Mismatch START/END for %s/%s'
%
(
sfunc
,
func
)
)
sys
.
exit
()
deltatime
=
int
(
time
)
-
stime
# add time spent to this function
...
...
cmake/extract_qmtest_metadata.py
View file @
c1e46869
...
...
@@ -111,7 +111,7 @@ def analyze_suites(pkg, rootdir):
# transpose the dictionary of lists
test_labels
=
collections
.
defaultdict
(
set
)
for
label
,
tests
in
labels
.
iter
items
():
for
label
,
tests
in
labels
.
items
():
for
test
in
tests
:
test_labels
[
test
].
add
(
label
)
...
...
cmake/modules/scan_dict_deps.py
View file @
c1e46869
...
...
@@ -90,7 +90,7 @@ def main():
if
new_deps
!=
old_deps
:
# write it only if it has changed
open
(
output
,
'w'
).
write
(
new_deps
)
if
old_deps
and
not
opts
.
for_make
:
print
'info: dependencies changed: next build will trigger a reconfigure'
print
(
'info: dependencies changed: next build will trigger a reconfigure'
)
if
__name__
==
'__main__'
:
...
...
cmake/tests/cmake_coverage.py
View file @
c1e46869
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
__future__
import
print_function
import
os
import
re
import
atexit
...
...
@@ -22,7 +23,7 @@ def update_coverage():
else
:
data
=
{
'lines'
:
{}}
lines
=
data
[
'lines'
]
for
filename
,
linenumbers
in
coverage
.
iter
items
():
for
filename
,
linenumbers
in
coverage
.
items
():
lines
[
filename
]
=
sorted
(
linenumbers
.
union
(
lines
.
get
(
filename
,
[])))
with
open
(
COVERAGE_FILE
,
'w'
)
as
report
:
cPickle
.
dump
(
data
,
report
)
...
...
@@ -84,9 +85,9 @@ if __name__ == '__main__':
lines
=
data
[
'lines'
]
for
filename
in
sorted
(
lines
):
if
not
os
.
path
.
exists
(
filename
):
print
'Unknown file'
,
filename
print
(
'Unknown file'
,
filename
)
continue
print
filename
print
(
filename
)
active_lines
=
set
(
get_active_lines
(
filename
))
touched_lines
=
set
(
lines
[
filename
])
missed_lines
=
active_lines
.
difference
(
touched_lines
)
...
...
@@ -97,7 +98,7 @@ if __name__ == '__main__':
touched_count
=
len
(
touched_lines
)
active_count
=
len
(
active_lines
)
if
touched_count
==
active_count
:
print
' coverage 100%'
print
(
' coverage 100%'
)
else
:
print
(
' coverage %3d%%, missed: %s'
%
(
float
(
touched_count
)
/
active_count
*
100
,
', '
.
join
(
ranges
)))
cmake/tests/cmake_test_utils.py
View file @
c1e46869
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
__future__
import
print_function
from
cmake_coverage
import
cmake_script
from
os.path
import
join
,
curdir
...
...
@@ -21,10 +21,10 @@ class CMakeTestScripts(object):
def
run
(
self
,
name
):
script_name
=
join
(
self
.
scripts_dir
,
'test_%s.cmake'
%
name
)
out
,
err
,
returncode
=
cmake_script
(
script_name
,
cwd
=
self
.
base_dir
)
print
"---------- stdout ----------"
print
out
print
"---------- stderr ----------"
print
err
print
(
"---------- stdout ----------"
)
print
(
out
)
print
(
"---------- stderr ----------"
)
print
(
err
)
assert
returncode
==
0
def
test_scripts
(
self
):
...
...
cmake/tests/test_crashes.py
View file @
c1e46869
# -*- coding: utf-8 -*-
from
__future__
import
print_function
from
cmake_coverage
import
cmake_script
from
os.path
import
join
,
dirname
...
...
@@ -10,10 +10,10 @@ scripts_dir = join(base_dir, 'cmake_scripts')
def
test_loops
():
script_name
=
join
(
scripts_dir
,
'test_loops.cmake'
)
out
,
err
,
returncode
=
cmake_script
(
script_name
,
cwd
=
base_dir
)
print
"---------- stdout ----------"
print
out
print
"---------- stderr ----------"
print
err
print
(
"---------- stdout ----------"
)
print
(
out
)
print
(
"---------- stderr ----------"
)
print
(
err
)
assert
returncode
!=
0
assert
'Infinite recursion detected at project Loop'
in
err
...
...
@@ -21,9 +21,9 @@ def test_loops():
def
test_missing_base
():
script_name
=
join
(
scripts_dir
,
'test_missing_base.cmake'
)
out
,
err
,
returncode
=
cmake_script
(
script_name
,
cwd
=
base_dir
)
print
"---------- stdout ----------"
print
out
print
"---------- stderr ----------"
print
err
print
(
"---------- stdout ----------"
)
print
(
out
)
print
(
"---------- stderr ----------"
)
print
(
err
)
assert
returncode
!=
0
assert
'Cannot find project IDoNotExist v0r0'
in
err
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment