~linaro-toolchain-dev/cortex-strings/trunk

« back to all changes in this revision

Viewing changes to scripts/fixup.py

  • Committer: Michael Hope
  • Date: 2010-08-26 22:37:26 UTC
  • Revision ID: michael.hope@linaro.org-20100826223726-lo6udrvh314vf639
Added the dhrystone 2.1 benchmark from benchnt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""Simple script that enables target specific blocks based on the first argument.
2
 
 
3
 
Matches comment blocks like this:
4
 
 
5
 
/* For Foo: abc
6
 
def
7
 
*/
8
 
 
9
 
and de-comments them giving:
10
 
abc
11
 
def
12
 
"""
13
 
import re
14
 
import sys
15
 
 
16
 
def main():
17
 
    key = sys.argv[1]
18
 
    expr = re.compile(r'/\* For %s:\s([^*]+)\*/' % key, re.M)
19
 
 
20
 
    for arg in sys.argv[2:]:
21
 
        with open(arg) as f:
22
 
            body = f.read()
23
 
        with open(arg, 'w') as f:
24
 
            f.write(expr.sub(r'\1', body))
25
 
 
26
 
if __name__ == '__main__':
27
 
    main()