Mercurial > hg > carton
diff carton.py @ 15:f05e636b7444
now you can specify the name of the env in the created script
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 08 Jul 2011 15:35:53 -0700 |
parents | c474362cf69a |
children | c91abbdc871b |
line wrap: on
line diff
--- a/carton.py Fri Jul 08 15:23:04 2011 -0700 +++ b/carton.py Fri Jul 08 15:35:53 2011 -0700 @@ -26,6 +26,8 @@ virtualenv_url = 'http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.6.1.tar.gz' template = """#!/usr/bin/env python +"create a virtualenv at %(ENV)s" + import os import shutil import subprocess @@ -48,6 +50,14 @@ VIRTUAL_ENV='''%(VIRTUAL_ENV)s'''.decode('base64').decode('zlib') PACKAGE_SOURCES=%(PACKAGE_SOURCES)s +# parse options +usage = os.path.basename(sys.argv[0]) + ' [options]' +parser = OptionParser(usage=usage, description=__doc__) +parser.add_option('--env', dest='env', help="environment name [DEFAULT: " + ENV + "]") +options, args = parser.parse_args() +if options.env: + ENV = options.env + # unpack virtualenv tempdir = tempfile.mkdtemp() buffer = StringIO()