2007-07-02 11:20:24 -07:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
from optparse import OptionParser
|
|
|
|
from datetime import datetime
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
|
|
|
o = OptionParser()
|
2008-01-14 07:24:19 -08:00
|
|
|
o.add_option("--buildid", dest="buildid")
|
2007-07-02 11:20:24 -07:00
|
|
|
o.add_option("--print-buildid", action="store_true", dest="print_buildid")
|
|
|
|
|
|
|
|
(options, args) = o.parse_args()
|
|
|
|
|
|
|
|
if options.print_buildid:
|
2008-08-07 11:10:47 -07:00
|
|
|
print datetime.now().strftime('%Y%m%d%H%M%S')
|
2007-07-02 11:20:24 -07:00
|
|
|
sys.exit(0)
|
|
|
|
|
2008-01-14 07:24:19 -08:00
|
|
|
if not options.buildid:
|
|
|
|
print >>sys.stderr, "--buildid is required"
|
|
|
|
sys.exit(1)
|
|
|
|
|
2007-07-02 11:20:24 -07:00
|
|
|
(milestoneFile,) = args
|
|
|
|
for line in open(milestoneFile, 'r'):
|
|
|
|
if line[0] == '#':
|
|
|
|
continue
|
|
|
|
|
|
|
|
line = line.strip()
|
|
|
|
if line == '':
|
|
|
|
continue
|
|
|
|
|
|
|
|
milestone = line
|
|
|
|
|
|
|
|
print """[Build]
|
|
|
|
BuildID=%s
|
2008-01-14 07:24:19 -08:00
|
|
|
Milestone=%s""" % (options.buildid, milestone)
|