# HG changeset patch # User Jeff Hammel # Date 1272039471 25200 # Node ID f63e51490c614f5954e5d709c4e754946e99d998 # Parent 9726bc99fb13c2f0a6908032d5ef5d3052577b6d expand user paths and better documentation diff -r 9726bc99fb13 -r f63e51490c61 stampit/main.py --- a/stampit/main.py Fri Apr 23 09:05:22 2010 -0700 +++ b/stampit/main.py Fri Apr 23 09:17:51 2010 -0700 @@ -33,6 +33,9 @@ # XXX this is actually a very long way to work around just getting the # tarballs as pip magically does this for you! ::sigh:: # not sure of a better/easier way, though + # should look at the `pip` api and see what's going on there; + # if pip is already installed, there's probably no need to make the + # virtualenv at all if 'PYTHONHOME' in os.environ: del os.environ['PYTHONHOME'] # just make sure this is killed @@ -58,6 +61,11 @@ parser.add_option('--virtualenv', help='path to virtualenv to use') options, args = parser.parse_args(args) + for option in 'virtualenv', 'output', 'directory': + # expand ~ arguments + path = getattr(options, option) + if path is not None and '~' in path: + setattr(options, option, os.path.expanduser(path)) callargs = options.verbose and {} or { 'stdout': subprocess.PIPE } if options.quiet: callargs['stderr'] = subprocess.PIPE @@ -68,7 +76,7 @@ # locate virtualenv if options.virtualenv: if not os.path.exists(options.virtualenv): - parser.error("'%s', specified by --virtualenv, does not exist") + parser.error("'%s', specified by --virtualenv, does not exist", options.virtualenv) else: options.virtualenv = which('virtualenv') virtualenv_dir = None