Esempio n. 1
0
    def runConvertation(self, pathSrc, pathBin):
        myutil.createDirs(pathBin)
        pathSrcDir = os.path.dirname(pathSrc)

        scg2scs.parse_scg(pathSrc)
        tmpfile = os.tmpfile()  #open(pathSrc + ".tscs", "w")
        scg2scs.write_scs(tmpfile)
        tmpfile.seek(os.SEEK_SET)

        cmd = "%s -nc -I\"%s\" -I\"%s\" - \"%s\"" % (
            defines.SCS2TGF, defines.INCLUDES, os.path.dirname(pathSrc),
            pathBin)
        process = Popen(cmd, stdin=tmpfile, stdout=PIPE, stderr=PIPE)
        process.wait()

        try:
            if process.returncode == 0:
                return True
            else:
                print >> sys.stderr, "In file %s:" % (pathSrc)
                myutil.printPipe(sys.stderr, process.stderr)
                return False
        finally:
            process.stdout.close()
            process.stderr.close()
Esempio n. 2
0
 def runConvertation(self, pathSrc, pathBin):
     myutil.createDirs(pathBin)
     pathSrcDir = os.path.dirname(pathSrc)
     
     scg2scs.parse_scg(pathSrc)
     tmpfile = os.tmpfile() #open(pathSrc + ".tscs", "w")
     scg2scs.write_scs(tmpfile)
     tmpfile.seek(os.SEEK_SET)
     
     cmd = "%s -nc -I\"%s\" -I\"%s\" - \"%s\"" % (SCS2TGF, INCLUDES, os.path.dirname(pathSrc), pathBin)
     process = Popen(cmd, stdin=tmpfile, stdout=PIPE, stderr=PIPE)
     process.wait()
     
     try:
         if process.returncode == 0:
             return True
         else:
             print >> sys.stderr, "In file %s:" % (pathSrc)
             myutil.printPipe(sys.stderr, process.stderr)
             return False
     finally:
         process.stdout.close()
         process.stderr.close()
Esempio n. 3
0
    def runConvertation(self, pathSrc, pathBin):
        myutil.createDirs(pathBin)
        pathSrcDir = os.path.dirname(pathSrc)

        scg2scs.parse_scg(pathSrc)
        tmpfile = os.tmpfile() #open(pathSrc + ".tscs", "w")
        scg2scs.write_scs(tmpfile)
        
        #print tmpfile.name
        

#   dfile = open(pathBin + ".tscs", "w")
#   scg2scs.write_scs(dfile)
#   dfile.close()

        tmpfile.seek(os.SEEK_SET)

        #cmd = [defines.SCS2TGF, '-nc', '-I' + defines.INCLUDES, '-I' + os.path.dirname(pathSrc), '-', pathBin]
        
        if defines.NEW_SC_MODEL:
            cmd = [defines.SCC, '-', '-a', '-I %s' % (defines.INCLUDES), '-I %s' % (os.path.dirname(pathSrc)), '-o %s' % (pathBin)]
            process = Popen(cmd, stdin=tmpfile, stdout=PIPE, stderr=PIPE)
        else:
            cmd = ['-nc', '-I%s' % defines.INCLUDES, '-I%s' % os.path.dirname(pathSrc), '-', pathBin]
            process = Popen(cmd, executable=defines.SCS2TGF, stdin=tmpfile, stdout=PIPE, stderr=PIPE)
        process.wait()

        try:
            if process.returncode == 0:
                return True
            else:
                print >> sys.stderr, "In file %s:" % (pathSrc)
                myutil.printPipe(sys.stderr, process.stderr)
                return False
        finally:
            process.stdout.close()
            process.stderr.close()