Commits

David Wolever committed c709713

Some cleanup after talking with dhellmann

Comments (0)

Files changed (2)

virtualenvwrapper.sh

 
 # If the path is relative, prefix it with $HOME
 # (note: for compatibility)
-if echo "$WORKON_HOME" | grep -e '^[^/~]'
+if echo "$WORKON_HOME" | grep -e '^[^/~]' > /dev/null
 then
     export WORKON_HOME="$HOME/$WORKON_HOME"
 fi
 # path might contain stuff to expand.
 # (it might be possible to do this in shell, but I don't know a
 # cross-shell-safe way of doing it -wolever)
-if echo "$WORKON_HOME" | grep -e "[$~]"
+if echo "$WORKON_HOME" | grep -e "[$~]" > /dev/null
 then
     # This will normalize the path by:
     # - Expanding variables (eg, $foo)
 
 # Expects 1 argument, the suffix for the new file.
 virtualenvwrapper_tempfile () {
-    tempfile "virtualenvwrapper-XXXXXX-$1"
+    mktemp "virtualenvwrapper-XXXXXX-$1"
 }
 
 # Run the hooks
 virtualenvwrapper_run_hook () {
     hook_script="$(virtualenvwrapper_tempfile hook)"
-    "$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' $HOOK_VERBOSE_OPTION --run-hook-and-write-source "$hook_script" "$@"
+    "$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' $HOOK_VERBOSE_OPTION --script "$hook_script" "$@"
     result=$?
     
     if [ $result -eq 0 ]
     then
         source "$hook_script"
     fi
-    rm -f "$hook_script" > /dev/null 2>&1 
+    rm -f "$hook_script" &> /dev/null
     return $result
 }
 
         echo "Please specify target virtualenv"
         return 1
     fi
-    if echo "$WORKON_HOME" | grep -e "/$"
+    if echo "$WORKON_HOME" | grep -e "/$" > /dev/null
     then
         env_home="$WORKON_HOME"
     else

virtualenvwrapper/hook_loader.py

         description='Manage hooks for virtualenvwrapper',
         )
 
-    parser.add_option('-S', '--run-hook-and-write-source',
-                      help='Runs "hook" and runs "<hook>_source", writing the ' +
+    parser.add_option('-S', '--script',
+                      help='Runs "hook" then "<hook>_source", writing the ' +
                            'result to <file>',
-                      dest='source_filename',
+                      dest='script_filename',
                       default=None,
                       )
     parser.add_option('-s', '--source',
         parser.error('Please specify the hook to run')
     hook = args[0]
 
-    if options.sourcing and options.source_filename:
-        parser.error('--source and --run-hook-and-write-source are mutually ' +
-                     'exclusive.')
+    if options.sourcing and options.script_filename:
+        parser.error('--source and --script are mutually exclusive.')
 
     if options.sourcing:
         hook += '_source'
 
     run_hooks(hook, options, args)
 
-    if options.source_filename:
+    if options.script_filename:
         options.sourcing = True
-        output = open(options.source_filename, "w")
+        output = open(options.script_filename, "w")
         try:
             run_hooks(hook + '_source', options, args, output)
         finally:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.