comparison python/applyrealhard.py @ 520:3281b9fe4433

wip
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 20 Sep 2013 08:43:59 -0700
parents 8b990efa4648
children c4432bd3cb9b
comparison
equal deleted inserted replaced
519:8b990efa4648 520:3281b9fe4433
17 17
18 wiggle = which('wiggle') 18 wiggle = which('wiggle')
19 19
20 def find(directory, pattern): 20 def find(directory, pattern):
21 # TODO: -> python 21 # TODO: -> python
22 return [i for i in subprocess.check_output(['find', directory, '-iname', patten]).splitlines() if i.strip()] 22 return [i for i in subprocess.check_output(['find', directory, '-iname', pattern]).splitlines() if i.strip()]
23 23
24 def rejects(directory): 24 def rejects(directory):
25 """all rejects in directory""" 25 """all rejects in directory"""
26 # TODO: not call out to find 26 # TODO: not call out to find
27 27 return find(directory, '*.rej')
28 28
29 def main(args=sys.argv[1:]): 29 def main(args=sys.argv[1:]):
30 30
31 usage = '%prog [options]' 31 usage = '%prog [options]'
32 parser = optparse.OptionParser(usage=usage, description=__doc__) 32 parser = optparse.OptionParser(usage=usage, description=__doc__)
33 parser.add_option('-d', '--directory', default=os.getcwd()) 33 parser.add_option('-d', '--directory', default=os.getcwd())
34 options, args = parser.parse_args(args) 34 options, args = parser.parse_args(args)
35 35
36 36 # get rejects
37 rej = rejects(options.directory)
38 if not rej:
39 parser.error("No rejects")
40 print 'rej:\n%s\n' % '\n'.join([' %s' % r for r in rej])
41
42 for r in rej:
43 # find the corresponding file
44 pass
37 45
38 if __name__ == '__main__': 46 if __name__ == '__main__':
39 main() 47 main()