import datetime
+import optparse
import os
import sys
import tempfile
def main():
- pocket, package, commit = sys.argv[1:4]
+ parser = optparse.OptionParser('Usage: %prog pocket package commit')
+ opts, args = parser.parse_args()
+ if len(args) != 3:
+ parser.print_help()
+ return 1
+ pocket, package, commit = args
principal = os.environ['REMOTE_USER']
request_time = datetime.datetime.utcnow()
q_path = os.path.join(b._QUEUE_DIR,
q_fd, q_name = tempfile.mkstemp()
q = os.fdopen(q_fd, 'r+')
print >>q, "%s %s %s %s" % (pocket, package, commit, principal)
+ q.close()
os.rename(q_name, q_path)