##// END OF EJS Templates
upgrade_dir.py: skip junk files like *.pyc
vivainio -
Show More
@@ -36,13 +36,14 b' def upgrade_dir(srcdir, tgtdir):'
36
36
37 def pr(s):
37 def pr(s):
38 print s
38 print s
39
39 junk = ['.svn','ipythonrc*','*.pyc', '*~', '.hg']
40
40 def ignorable(p):
41 def ignorable(p):
41 if p.lower().startswith('.svn') or p.startswith('ipythonrc'):
42 for pat in junk:
42 return True
43 if p.startswith(pat) or p.fnmatch(pat):
44 return True
43 return False
45 return False
44
46
45
46 modded = []
47 modded = []
47 files = [path(srcdir).relpathto(p) for p in path(srcdir).walkfiles()]
48 files = [path(srcdir).relpathto(p) for p in path(srcdir).walkfiles()]
48 #print files
49 #print files
@@ -67,7 +68,7 b' def upgrade_dir(srcdir, tgtdir):'
67 sum = rpt.get(str(tgt), None)
68 sum = rpt.get(str(tgt), None)
68 #print sum
69 #print sum
69 if sum and md5.new(cont).hexdigest() == sum:
70 if sum and md5.new(cont).hexdigest() == sum:
70 pr("Unedited, installing new %s" % tgt)
71 pr("%s: Unedited, installing new version" % tgt)
71 tgt.write_text(src.text())
72 tgt.write_text(src.text())
72 rpt[str(tgt)] = md5.new(tgt.text()).hexdigest()
73 rpt[str(tgt)] = md5.new(tgt.text()).hexdigest()
73 else:
74 else:
@@ -76,7 +77,7 b' def upgrade_dir(srcdir, tgtdir):'
76 real = showdiff(tgt,src)
77 real = showdiff(tgt,src)
77 pr('') # empty line
78 pr('') # empty line
78 if not real:
79 if not real:
79 pr("(Ok, it wasn't that different at all, upgrading checksum)")
80 pr("(Ok, it was identical, only upgrading checksum)")
80 rpt[str(tgt)] = md5.new(tgt.text()).hexdigest()
81 rpt[str(tgt)] = md5.new(tgt.text()).hexdigest()
81 else:
82 else:
82 modded.append(tgt)
83 modded.append(tgt)
@@ -1,3 +1,7 b''
1 2007-04-19 Ville Vainio <vivainio@gmail.com>
2
3 * upgrade_dir.py: skip junk files like *.pyc
4
1 2007-04-18 Ville Vainio <vivainio@gmail.com>
5 2007-04-18 Ville Vainio <vivainio@gmail.com>
2
6
3 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
7 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
General Comments 0
You need to be logged in to leave comments. Login now