Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    r122cac7 rb70b6fc  
    22from __future__ import print_function
    33
    4 from os import listdir, environ
     4from os import listdir
    55from os.path import isfile, join, splitext
    66from subprocess import Popen, PIPE, STDOUT
    77
    88import argparse
    9 import os
    10 import re
    119import sys
    1210
     
    2927                proc.communicate()
    3028                return proc.returncode
    31 
    32 def file_replace(fname, pat, s_after):
    33     # first, see if the pattern is even in the file.
    34     with open(fname) as f:
    35         if not any(re.search(pat, line) for line in f):
    36             return # pattern does not occur in file so we are done.
    37 
    38     # pattern is in the file, so perform replace operation.
    39     with open(fname) as f:
    40         out_fname = fname + ".tmp"
    41         out = open(out_fname, "w")
    42         for line in f:
    43             out.write(re.sub(pat, s_after, line))
    44         out.close()
    45         os.rename(out_fname, fname)
    46 
    47 def fix_MakeLevel(file) :
    48         if environ.get('MAKELEVEL') :
    49                 file_replace(file, "make\[%i\]" % int(environ.get('MAKELEVEL')), 'make' )
    50 
    5129
    5230################################################################################
     
    7149
    7250        retcode = 0
    73 
    74         fix_MakeLevel(out_file)
    75 
    7651        if not generate :
    7752                # diff the output of the files
Note: See TracChangeset for help on using the changeset viewer.