Skip to content

Commit

Permalink
Merge branch 'jb49378_no_python2' into 'master'
Browse files Browse the repository at this point in the history
Port scripts to use python3

See merge request mer-core/profiled!4
  • Loading branch information
spiiroin committed Mar 18, 2020
2 parents ef80ddd + cb785f0 commit 0242c1d
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 517 deletions.
6 changes: 3 additions & 3 deletions .depend
Expand Up @@ -62,6 +62,9 @@ mainloop.o: mainloop.c \
server.h \
sighnd.h

profile-tracker.o: profile-tracker.c \
profile_dbus.h

profileclient.o: profileclient.c \
libprofile-internal.h \
libprofile.h \
Expand All @@ -74,9 +77,6 @@ profiled.o: profiled.c \
mainloop.h \
profiled_config.h

profile-tracker.o: profile-tracker.c \
profile_dbus.h

profileval.o: profileval.c \
profiled_config.h \
profileval.h \
Expand Down
37 changes: 17 additions & 20 deletions depend_filter.py
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3

# =============================================================================
# This file is part of profile-qt
Expand All @@ -11,26 +11,26 @@
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. Redistributions in
# binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. Redistributions in
# binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
# Neither the name of Nokia Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
# =============================================================================

Expand All @@ -46,12 +46,9 @@
if k in "-d":
DEST = v or args.pop()
else:
print>>sys.stderr, "Unknown option: %s" % a
print("Unknown option: %s" % a, file=sys.stderr)
sys.exit(1)

def dep_compare(a,b):
return cmp(a.count("/"),b.count("/")) or cmp(a,b)

def dep_filter(deps):
src, hdr = [], {}

Expand All @@ -62,8 +59,8 @@ def dep_filter(deps):
continue
elif not dep in hdr:
hdr[dep] = None
hdr = hdr.keys()
hdr.sort(dep_compare)
hdr = list(hdr.keys())
hdr.sort(key=lambda x:(x.count("/"), x))
return src + hdr

for line in sys.stdin.read().replace("\\\n", " ").split("\n"):
Expand All @@ -76,4 +73,4 @@ def dep_filter(deps):
dest = os.path.join(DEST, dest)

srce = dep_filter(srce.split())
print '%s: %s\n' % (dest, " \\\n ".join(srce))
print('%s: %s\n' % (dest, " \\\n ".join(srce)))
46 changes: 23 additions & 23 deletions flow.py
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3

# =============================================================================
# This file is part of profile-qt
Expand All @@ -11,26 +11,26 @@
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. Redistributions in
# binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. Redistributions in
# binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
# Neither the name of Nokia Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
# =============================================================================

Expand All @@ -49,9 +49,9 @@ def bgcolor(i):
r = (rgb >> 16) & 255
g = (rgb >> 8) & 255
b = (rgb >> 0) & 255
r = (255 * 2 + r * 1)/3
g = (255 * 2 + g * 1)/3
b = (255 * 2 + b * 1)/3
r = (255 * 2 + r * 1)//3
g = (255 * 2 + g * 1)//3
b = (255 * 2 + b * 1)//3
rgb = "#%02x%02x%02x" % (r,g,b)
return rgb

Expand Down Expand Up @@ -138,7 +138,7 @@ def parse_bool(s):
real,show = s.split("=")
set_module_mapping(real,show)
else:
print>>sys.stderr, "Unknown option:", a
print("Unknown option:", a, file=sys.stderr)
sys.exit(1)

if TOPLEVEL:
Expand Down Expand Up @@ -190,7 +190,7 @@ def parse_bool(s):
dst = (dst[1],dst[1])
tmp[(src,dst)]=None
dep = tmp
dep = dep.keys()
dep = list(dep.keys())

# - - - - - - - - - - - - - - - - - - - -
# enumerate nodes & clusters
Expand All @@ -201,12 +201,12 @@ def parse_bool(s):
clu = {}

def ref(cur):
if not obj.has_key(cur):
if cur not in obj:
obj[cur] = "node%04d" % len(obj)

sym,mod = cur

if not clu.has_key(mod):
if mod not in clu:
col[mod] = bgcolor(len(col))
clu[mod] = [cur]
else:
Expand Down Expand Up @@ -235,7 +235,7 @@ def ref(cur):
_('node[style=filled, fillcolor=yellow];')

_('')
for cur,name in obj.items():
for cur,name in list(obj.items()):
if CLUSTERIZE:
_('%s[label="%s"];' % (name,cur[0]))
else:
Expand All @@ -248,7 +248,7 @@ def ref(cur):
_('%s->%s;' % (obj[src], obj[dst]))

if CLUSTERIZE:
for mod,syms in clu.items():
for mod,syms in list(clu.items()):
_('')
_('subgraph cluster%s {' % mod.replace('-','_'))
#_('bgcolor="#f0f0f0";')
Expand All @@ -259,4 +259,4 @@ def ref(cur):

_('}')

print "\n".join(dot)
print("\n".join(dot))
122 changes: 0 additions & 122 deletions manager.py

This file was deleted.

0 comments on commit 0242c1d

Please sign in to comment.