changeset 10:f63e51490c61

expand user paths and better documentation
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 23 Apr 2010 09:17:51 -0700
parents 9726bc99fb13
children 7e538a4b0e79
files stampit/main.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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