Axel H. avatar Axel H. committed a20f320

Improved variable name: VIRTUALENVWRAPPER_ENV_BIN_DIR instead of script_folder and is_msys instead of msys.

Comments (0)

Files changed (2)

virtualenvwrapper.sh

 fi
 
 # Define script folder depending on the platorm (Win32/Unix)
-script_folder="bin"
+VIRTUALENVWRAPPER_ENV_BIN_DIR="bin"
 if [ "$OS" = "Windows_NT" ] && [ "$MSYSTEM" = "MINGW32" ]
 then
 	# Only assign this for msys, cygwin use standard Unix paths
 	# and its own python installation 
-	script_folder="Scripts"
+	VIRTUALENVWRAPPER_ENV_BIN_DIR="Scripts"
 fi
 
 virtualenvwrapper_derive_workon_home() {
     # NOTE: DO NOT use ls here because colorized versions spew control characters
     #       into the output list.
     # echo seems a little faster than find, even with -depth 3.
-    (cd "$WORKON_HOME"; for f in */$script_folder/activate; do echo $f; done) 2>/dev/null | \sed 's|^\./||' | \sed 's|/bin/activate||' | \sort | (unset GREP_OPTIONS; \egrep -v '^\*$')
+    (cd "$WORKON_HOME"; for f in */$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate; do echo $f; done) 2>/dev/null | \sed 's|^\./||' | \sed 's|/bin/activate||' | \sort | (unset GREP_OPTIONS; \egrep -v '^\*$')
     
 #    (cd "$WORKON_HOME"; find -L . -depth 3 -path '*/bin/activate') | sed 's|^\./||' | sed 's|/bin/activate||' | sort
 }
     virtualenvwrapper_verify_workon_home || return 1
     virtualenvwrapper_verify_workon_environment $env_name || return 1
     
-    activate="$WORKON_HOME/$env_name/$script_folder/activate"
+    activate="$WORKON_HOME/$env_name/$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate"
     if [ ! -f "$activate" ]
     then
         echo "ERROR: Environment '$WORKON_HOME/$env_name' does not contain an activate script." >&2
         # any settings made by the local postactivate first.
         virtualenvwrapper_run_hook "pre_deactivate"
         
-        env_postdeactivate_hook="$VIRTUAL_ENV/$script_folder/postdeactivate"
+        env_postdeactivate_hook="$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/postdeactivate"
         old_env=$(basename "$VIRTUAL_ENV")
         
         # Call the original function.
     fi
 
     \cp -r "$source_env" "$target_env"
-    for script in $( \ls $target_env/$script_folder/* )
+    for script in $( \ls $target_env/$VIRTUALENVWRAPPER_ENV_BIN_DIR/* )
     do
         newscript="$script-new"
         \sed "s|$source_env|$target_env|g" < "$script" > "$newscript"
     done
 
     virtualenv "$target_env" --relocatable
-    \sed "s/VIRTUAL_ENV\(.*\)$env_name/VIRTUAL_ENV\1$new_env/g" < "$source_env/bin/activate" > "$target_env/$script_folder/activate"
+    \sed "s/VIRTUAL_ENV\(.*\)$env_name/VIRTUAL_ENV\1$new_env/g" < "$source_env/bin/activate" > "$target_env/$VIRTUALENVWRAPPER_ENV_BIN_DIR/activate"
 
     (cd "$WORKON_HOME" && ( 
         virtualenvwrapper_run_hook "pre_cpvirtualenv" "$env_name" "$new_env";

virtualenvwrapper/user_scripts.py

     
 # Are we running under msys
 if sys.platform == 'win32' and os.environ.get('OS') == 'Windows_NT' and os.environ.get('MSYSTEM') == 'MINGW32':
-    msys = True
+    is_msys = True
     script_folder = 'Scripts'
 else:
     script_folder = 'bin'
     """
     if os.path.exists(script_path):
         cmd = [script_path] + list(args)
-        if msys:
+        if is_msys:
             cmd = [get_path(os.environ['MSYS_HOME'],'bin','sh.exe')] + cmd
         log.debug('running %s', str(cmd))
         try:
 def get_path(*args):
     '''
     Get a full path from args.
-    Path separator is determined according to the os and the shell and allow to use msys.
+    Path separator is determined according to the os and the shell and allow to use is_msys.
     Variables and user are expanded during the process.
     '''
     path = os.path.expanduser(os.path.expandvars(os.path.join(*args)))
-    if msys:
-        # MSYS accept unix or Win32 and sometimes it conduce to mixed style paths
+    if is_msys:
+        # MSYS accept unix or Win32 and sometimes it drives to mixed style paths
         if re.match(r'^/[a-zA-Z](/|^)', path):
             # msys path could starts with '/c/'-form drive letter
             path = ''.join((path[1],':',path[2:]))
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.