#!/usr/bin/env python
REVIEWBOARD_HOST = 'http://reviewboard.eng.vmware.com'
import httplib, mimetypes, mimetools, urllib2, cookielib, os, sys, getpass
import re
import simplejson
from optparse import OptionParser
from tempfile import mkstemp
VERSION = "0.1"
if os.environ.has_key("USERPROFILE"):
cookiepath = os.path.join(os.environ["USERPROFILE"], "UserData")
else:
cookiepath = os.environ["HOME"]
cj = cookielib.MozillaCookieJar()
cookiefile = os.path.join(cookiepath, ".post-review-cookies.txt")
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent', 'reviewboard-bug.py/' + VERSION)]
urllib2.install_opener(opener)
tempfiles = []
options = None
class APIError(Exception):
pass
def debug(s):
pass
#print ">>> %s" % s
def die(msg=None):
for tmpfile in tempfiles:
try:
os.unlink(tmpfile)
except:
pass
if msg:
print msg
sys.exit(1)