Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 83 lines (64 sloc) 2.163 kb
#!/usr/bin/env python
create a mozmill carton
import optparse
import os
import shutil
import sys
import tempfile
from subprocess import check_call as call
except ImportError:
from subprocess import call
### stuff that should be in the stdlib
def which(fileName, path=os.environ['PATH']):
"""python equivalent of which; should really be in the stdlib"""
dirs = path.split(os.pathsep)
for dir in dirs:
if os.path.isfile(os.path.join(dir, fileName)):
return os.path.join(dir, fileName)
def require(url):
import a module from the web
url should be like scheme://
import imp
import urllib2
contents = urllib2.urlopen(url).read()
filename = url.rsplit('/', 1)[-1]
modulename = filename.rsplit('.', 1)[-1]
fd, filename = tempfile.mkstemp(suffix='.py', prefix=modulename)
os.write(fd, contents)
module = imp.load_source(modulename, filename)
return module
### requirements
carton = require('')
git = which('git')
MOZBASE = 'git://'
MOZMILL = 'git://'
def main(args=sys.argv[1:]):
assert git, 'git executable not found!'
# parse command line options
parser = optparse.OptionParser()
parser.add_option('--name', dest='name', default='mozmill-env',
help='name of the environment')
options, args = parser.parse_args(args)
# checkout mozbase
tempdir = tempfile.mkdtemp()
mozbasedir = os.path.join(tempdir, 'mozbase')
call([git, 'clone', MOZBASE, mozbasedir])
# checkout mozmill
mozmilldir = os.path.join(tempdir, 'mozmill')
call([git, 'clone', MOZMILL, mozmilldir])
# make a carton
carton.main([, mozmilldir, mozbasedir,
'--python-script', 'src/mozbase/',
'--python-script', 'src/mozmill/',
# remove vestiges
if __name__ == '__main__':
Jump to Line
Something went wrong with that request. Please try again.