Changeset 679c361 in mainline for tools/checkers/vcc.py


Ignore:
Timestamp:
2010-01-05T12:57:32Z (14 years ago)
Author:
U-ALPHA\Administrator <Administrator@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ed63298
Parents:
04c3a21f
Message:

preprocess sources using GCC preprocessor
run Vcc with correct Windows path

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/checkers/vcc.py

    r04c3a21f r679c361  
    4545        print prname + " <ROOT>"
    4646
     47def cygpath(upath):
     48        "Convert Unix (Cygwin) path to Windows path"
     49       
     50        return subprocess.Popen(['cygpath', '--windows', '--absolute', upath], stdout = subprocess.PIPE).communicate()[0].strip()
     51
     52def preprocess(srcfname, tmpfname, base, options):
     53        "Preprocess source using GCC preprocessor"
     54       
     55        args = ['gcc', '-E']
     56        args.extend(options.split())
     57        args.extend(['-o', tmpfname, srcfname])
     58       
     59        cwd = os.getcwd()
     60        os.chdir(base)
     61        retval = subprocess.Popen(args).wait()
     62        os.chdir(cwd)
     63       
     64        if (retval != 0):
     65                return False
     66       
     67        return True
     68
    4769def vcc(root, job):
    4870        "Run Vcc on a jobfile"
     
    80102                        return False
    81103               
     104                tmpfname = "%s.preproc" % srcfname
     105                tmpfqname = os.path.join(base, tmpfname)
     106               
    82107                # Only C files are interesting for us
    83108                if (arg[2] != "cc"):
    84109                        continue
    85110               
    86                 # Run Stanse
     111                # Preprocess sources
    87112               
    88                 retval = subprocess.Popen(['vcc', srcfqname]).wait()
     113                if (not preprocess(srcfname, tmpfname, base, options)):
     114                        return False
     115               
     116                # Run Vcc
     117               
     118                retval = subprocess.Popen(['vcc', cygpath(tmpfqname)]).wait()
     119               
     120                # Cleanup
     121               
     122                if (os.path.isfile(tmpfqname)):
     123                        os.remove(tmpfqname)
    89124               
    90125                if (retval != 0):
    91126                        return False
    92127       
    93         return False
     128        return True
    94129
    95130def main():
Note: See TracChangeset for help on using the changeset viewer.