# HG changeset patch # User Jeff Hammel # Date 1310164553 25200 # Node ID f05e636b744409a513ae9086c055aa70b091aaf5 # Parent c474362cf69a50fda53455d030ae7534e838feb9 now you can specify the name of the env in the created script diff -r c474362cf69a -r f05e636b7444 carton.py --- 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()