X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=tools%2Flttng-gen-tp;h=6aa1bba15d05012cf75e8d3aa0af69d4efa67bdf;hb=2eab9f28f1a6a9f7e24c528a4a6418d44d370426;hp=c49e8a52355f44e7ded0abcce24acf3836e5ee3e;hpb=aa4e204a59f9fd4fc94f2e2b3efa9f16ca86ac5a;p=lttng-ust.git diff --git a/tools/lttng-gen-tp b/tools/lttng-gen-tp index c49e8a52..6aa1bba1 100755 --- a/tools/lttng-gen-tp +++ b/tools/lttng-gen-tp @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Copyright (c) 2012 Yannick Brosseau # @@ -79,7 +79,9 @@ class CFile: def write(self): outputFile = open(self.outputFilename,"w") - headerFilename = self.outputFilename.replace(".c",".h") + headerFilename = self.outputFilename + if headerFilename.endswith(".c"): + headerFilename = headerFilename[:-2] + ".h" outputFile.write(CFile.FILE_TPL.format( headerFilename = headerFilename)) @@ -94,7 +96,7 @@ class ObjFile: if 'CC' in os.environ: cc = os.environ['CC'] try: - subprocess.call(cc, + subprocess.call(cc.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) except OSError as msg: @@ -126,7 +128,10 @@ class ObjFile: return cc def write(self): - cFilename = self.outputFilename.replace(".o",".c") + cFilename = self.outputFilename + if cFilename.endswith(".o"): + cFilename = cFilename[:-2] + ".c" + cc = self._detectCC() if cc == "": raise RuntimeError("No C Compiler detected")