From 736f09c4bcb74e7d36dc97774558bfbaa240fdd5 Mon Sep 17 00:00:00 2001 From: Martin Beyer Date: Thu, 11 Nov 2010 19:18:24 +0100 Subject: [PATCH] fixed ptxdump for python3 --- src/ptxdump.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ptxdump.py b/src/ptxdump.py index 1b31a35769..187c0c8fa6 100644 --- a/src/ptxdump.py +++ b/src/ptxdump.py @@ -1,6 +1,6 @@ #!/usr/bin/env python from string import * -import os, commands, getopt, sys, platform +import os, getopt, sys, platform header = '''/* Auto-generated by ptxdump.py DO NOT EDIT * @@ -16,13 +16,13 @@ def FormatCharHex(d): return s def CleanFileName(f): - v = replace(f,"-","_") - v = replace(v,".ptx","") + v = f.replace("-","_") + v = v.replace(".ptx","") return v if not(len(sys.argv[1:]) >= 2): - print "Usage: ptx2c.py " - print "Description: creates a header file containing the ptx files as character array" + os.linesep + print("Usage: ptx2c.py ") + print("Description: creates a header file containing the ptx files as character array" + os.linesep) sys.exit(0) out_h = sys.argv[1] + ".h" @@ -56,8 +56,8 @@ for file in sys.argv[2:]: # write retrieval function out.writelines("const unsigned char* SCCudaPtxDumpGetModule(const char* module){\n"); for file in sys.argv[2:]: - out.writelines('\tif (!strcmp(module, "'+replace(file,".ptx","")+'"))\n') - out.writelines("\t\treturn "+CleanFileName(file)+";\n") + out.writelines('\tif (!strcmp(module, "' + file.replace(".ptx","")+'"))\n') + out.writelines("\t\treturn " + CleanFileName(file)+";\n") out.writelines('\tSCLogError(SC_ERR_FATAL, "Error in SCCudaPtxDumpGetModule, module %s not found. Exiting...",module);\n') out.writelines("\texit(EXIT_FAILURE);\n") out.writelines("};\n")