~am-monkeyd/beat-box/gdbus

« back to all changes in this revision

Viewing changes to .waf-1.6.2-ad4cc42bd7d347f7e283789e711b993f/waflib/fixpy2.py

  • Committer: Scott Ringwelski
  • Date: 2011-03-27 05:15:34 UTC
  • Revision ID: sgringwe@mtu.edu-20110327051534-tpmkjnschn7t7403
ignore some files and maybe something else

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
 
# encoding: utf-8
3
 
# WARNING! All changes made to this file will be lost!
4
 
 
5
 
import os
6
 
all_modifs={}
7
 
def fixdir(dir):
8
 
        global all_modifs
9
 
        for k in all_modifs:
10
 
                for v in all_modifs[k]:
11
 
                        modif(os.path.join(dir,'waflib'),k,v)
12
 
def modif(dir,name,fun):
13
 
        if name=='*':
14
 
                lst=[]
15
 
                for y in'. Tools extras'.split():
16
 
                        for x in os.listdir(os.path.join(dir,y)):
17
 
                                if x.endswith('.py'):
18
 
                                        lst.append(y+os.sep+x)
19
 
                for x in lst:
20
 
                        modif(dir,x,fun)
21
 
                return
22
 
        filename=os.path.join(dir,name)
23
 
        f=open(filename,'r')
24
 
        txt=f.read()
25
 
        f.close()
26
 
        txt=fun(txt)
27
 
        f=open(filename,'w')
28
 
        f.write(txt)
29
 
        f.close()
30
 
def subst(*k):
31
 
        def do_subst(fun):
32
 
                global all_modifs
33
 
                for x in k:
34
 
                        try:
35
 
                                all_modifs[x].append(fun)
36
 
                        except KeyError:
37
 
                                all_modifs[x]=[fun]
38
 
                return fun
39
 
        return do_subst
40
 
def r1(code):
41
 
        code=code.replace(',e:',',e:')
42
 
        code=code.replace("",'')
43
 
        code=code.replace('','')
44
 
        return code
45
 
def r4(code):
46
 
        code=code.replace('next(self.biter)','self.biter.next()')
47
 
        return code
48
 
 
49
 
subst('*')(r1)
50
 
subst('Runner.py')(r4)
 
 
b'\\ No newline at end of file'