Пример #1
0
    def runConvertation(self, pathSrc, pathBin):
        myutil.createDirs(pathBin)
        pathSrcDir = os.path.dirname(pathSrc)

        cmdM4 = "%s -I\"%s\" \"%s\" \"%s\"" % (defines.M4, pathSrcDir,
                                               defines.M4SCP, pathSrc)
        processM4 = Popen(cmdM4, stdout=PIPE, stderr=PIPE)

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

        processM4.stderr.close()
        processScs.stdout.close()

        try:
            if processScs.returncode == 0:
                return True
            else:
                print >> sys.stderr, "In file %s:" % (pathSrc)
                myutil.printPipe(sys.stderr, processScs.stderr)
                return False
        finally:
            processScs.stderr.close()
Пример #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\"" % (
            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()
Пример #3
0
	def runConvertation(self, pathSrc, pathBin):
		myutil.createDirs(pathBin)
		
		cmd = "%s -nc -I\"%s\" -I\"%s\" \"%s\" \"%s\"" % (SCS2TGF, INCLUDES, os.path.dirname(pathSrc), \
														  pathSrc, \
														  pathBin)
		process = Popen(cmd, stdout=PIPE, stderr=PIPE)
		process.stdout.close()
		process.wait()
		
		try:
			if process.returncode == 0:
				return True
			else:
				myutil.printPipe(sys.stderr, process.stderr)
				return False
		finally:
			process.stderr.close()
Пример #4
0
    def runConvertation(self, pathSrc, pathBin):
        myutil.createDirs(pathBin)

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

        try:
            if process.returncode == 0:
                return True
            else:
                myutil.printPipe(sys.stderr, process.stderr)
                return False
        finally:
            process.stderr.close()
Пример #5
0
    def runConvertation(self, pathSrc, pathBin):
        myutil.createDirs(pathBin)

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

        try:
            if process.returncode == 0:
                return True
            else:
                myutil.printPipe(sys.stderr, process.stderr)
                return False
        finally:
            process.stderr.close()
Пример #6
0
    def runConvertation(self, pathSrc, pathBin):
        myutil.createDirs(pathBin)
        pathSrcDir = os.path.dirname(pathSrc)

        cmdM4 = "%s -I\"%s\" \"%s\" \"%s\"" % (defines.M4, pathSrcDir, defines.M4SCP, pathSrc)
        processM4 = Popen(cmdM4, stdout=PIPE, stderr=PIPE)

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

        processM4.stderr.close()
        processScs.stdout.close()

        try:
            if processScs.returncode == 0:
                return True
            else:
                print >> sys.stderr, "In file %s:" % (pathSrc)
                myutil.printPipe(sys.stderr, processScs.stderr)
                return False
        finally:
            processScs.stderr.close()
Пример #7
0
    def runConvertation(self, pathSrc, pathBin):
        myutil.createDirs(pathBin)
        pathSrcDir = os.path.dirname(pathSrc)

        cmdM4 = ["-I" + pathSrcDir, defines.M4SCP, pathSrc]
        processM4 = Popen(cmdM4, executable=defines.M4, stdout=PIPE, stderr=PIPE)

        cmdScs = ["-nc", "-I" + defines.INCLUDES, "-I" + os.path.dirname(pathSrc), "-", pathBin]
        processScs = Popen(cmdScs, executable=defines.SCS2TGF, stdin=processM4.stdout, stdout=PIPE, stderr=PIPE)
        processScs.wait()

        processM4.stderr.close()
        processScs.stdout.close()

        try:
            if processScs.returncode == 0:
                return True
            else:
                print >>sys.stderr, "In file %s:" % (pathSrc)
                myutil.printPipe(sys.stderr, processScs.stderr)
                return False
        finally:
            processScs.stderr.close()
Пример #8
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()
Пример #9
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()