kcachegrind: patch for python3

This commit is contained in:
classabbyamp 2023-10-07 04:51:37 -04:00 committed by classabbyamp
parent 1c541dafb3
commit 4d696def0b
2 changed files with 79 additions and 2 deletions

View file

@ -0,0 +1,77 @@
--- a/converters/hotshot2calltree.in
+++ b/converters/hotshot2calltree.in
@@ -147,8 +147,8 @@
if (file_limit > 0) and (filecount > file_limit):
break
- print
- print "total_cost: % d Ticks",total_cost
+ print()
+ print("total_cost: % d Ticks",total_cost)
dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
@@ -234,9 +234,9 @@
return_from_call(caller_stack, call_dict, total_cost)
except IOError:
- print "could not open inputfile '%s', ignore this." % inputfilename
- except EOFError, m:
- print "EOF: %s" % (m,)
+ print("could not open inputfile '%s', ignore this." % inputfilename)
+ except EOFError as m:
+ print("EOF: %s" % (m,))
return total_cost
def pretty_name(file, function):
@@ -252,7 +252,7 @@
self.last_values = {}
def clearTag(self, tag):
- if self.last_values.has_key(tag):
+ if tag in self.last_values.keys():
del self.last_values[ tag ]
def clear(self):
self.last_values = {}
@@ -316,16 +316,16 @@
def run_without_optparse():
"""parse the options without optparse, use sys.argv"""
if len(sys.argv) < 4 or sys.argv[1] != "-o" :
- print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
+ print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
return
outputfilename = sys.argv[2]
try:
- output = file(outputfilename, "w")
+ output = open(outputfilename, "w")
args = sys.argv[3:]
convertProfFiles(output, args)
output.close()
except IOError:
- print "could not open '%s' for writing." % outputfilename
+ print("could not open '%s' for writing." % outputfilename)
def run_with_optparse():
"""parse the options with optparse"""
@@ -346,10 +346,10 @@
file_limit = int(options.file_limit)
try:
if options.outputfilename and options.outputfilename != "-":
- output = file(options.outputfilename, "w")
+ output = open(options.outputfilename, "w")
close_output = 1
except IOError:
- print "could not open '%s' for writing." % options.outputfilename
+ print("could not open '%s' for writing." % options.outputfilename)
if output:
convertProfFiles(output, args)
if close_output:
@@ -364,7 +364,7 @@
prof.runcall(run)
prof.close()
else:
- print "not profiling myself, since '%s' exists, running normal" % filename
+ print("not profiling myself, since '%s' exists, running normal" % filename)
run()
# check if optparse is available.

View file

@ -1,7 +1,7 @@
# Template file for 'kcachegrind' # Template file for 'kcachegrind'
pkgname=kcachegrind pkgname=kcachegrind
version=23.08.0 version=23.08.0
revision=1 revision=2
build_style=cmake build_style=cmake
hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
pkg-config qt5-host-tools qt5-qmake" pkg-config qt5-host-tools qt5-qmake"
@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind" changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz" distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
python_version=2 python_version=3