Index: /gs3-extensions/virtualenv-python/trunk/CREATE-VENV-PYTHON3.sh
===================================================================
--- /gs3-extensions/virtualenv-python/trunk/CREATE-VENV-PYTHON3.sh	(revision 36310)
+++ /gs3-extensions/virtualenv-python/trunk/CREATE-VENV-PYTHON3.sh	(revision 36310)
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+source ./setup.bash
+
+if [ ! -d "$GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python3" ] ; then
+    python3 -mvenv "$GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python3"
+else
+    echo "" >&2
+    echo "!!!!" >&2
+    echo "! VirtualEnv Python3 already exists: $GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python3" >&2
+    echo "!!!!" >&2
+    echo "" >&2
+    echo "" >&2
+fi
+
+echo "****"
+echo "* To activate this version of python, enter:" 
+echo "*   source \"$GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python3/bin/activate\""
+echo "****"
+
+
Index: /gs3-extensions/virtualenv-python/trunk/DEVEL-TOP-LEVEL.sh
===================================================================
--- /gs3-extensions/virtualenv-python/trunk/DEVEL-TOP-LEVEL.sh	(revision 36310)
+++ /gs3-extensions/virtualenv-python/trunk/DEVEL-TOP-LEVEL.sh	(revision 36310)
@@ -0,0 +1,8 @@
+
+# Symlink this file so it is in the top-level Greenstone3 directory area
+
+source ./SETUP.sh
+
+source ./gs3-devel.sh
+
+
Index: /gs3-extensions/virtualenv-python/trunk/README.txt
===================================================================
--- /gs3-extensions/virtualenv-python/trunk/README.txt	(revision 36310)
+++ /gs3-extensions/virtualenv-python/trunk/README.txt	(revision 36310)
@@ -0,0 +1,25 @@
+#====
+# Getting the extension
+#====
+
+Assuming you are in the Greenstone3 top-level (i.e. GSDL3SRCHOME) directory,
+(if not already done so) this extension can be checked out as follows:
+
+  svn co https://svn.greenstone.org/gs3-extensions/virtualenv-python/trunk ext/virtualenv-python
+
+
+
+#-<>
+#  <One-time-only>
+#--
+
+cd ext/virtualenv-python
+./CREATE-VENV-PYTHON3.sh
+cd ../..
+
+ln -s ext/virtualenv-python/SETUP-TOP-LEVEL.sh SETUP.sh
+ln -s ext/virtualenv-python/DEVEL-TOP-LEVEL.sh DEVEL.sh
+
+#--
+#  </One-time-only>
+#</>
Index: /gs3-extensions/virtualenv-python/trunk/SETUP-TOP-LEVEL.sh
===================================================================
--- /gs3-extensions/virtualenv-python/trunk/SETUP-TOP-LEVEL.sh	(revision 36310)
+++ /gs3-extensions/virtualenv-python/trunk/SETUP-TOP-LEVEL.sh	(revision 36310)
@@ -0,0 +1,64 @@
+
+_full_pyver_=$(python3 -V 2>&1 | grep -Po '(?<=Python )(.+)')
+_majorminor_pyver_=${_full_pyver_%.*}
+
+# Symlink this file so it is in the top-level Greenstone3 directory area
+
+source ./gs3-setup.sh
+
+function check_pip_installed()
+{
+    if [ ! -d "$GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python3/lib/python${_majorminor_pyver_}/site-packages/$1" ] \
+	&& [ ! -f "$GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python3/lib/python${_majorminor_pyver_}/site-packages/$1.py" ] ; then
+	echo "!!!!" >&2
+	echo "! Failed to find directory or file: " >&2
+	echo "!   $GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python3/lib/python${_majorminor_pyver_}/site-packages/$1(.py)" >&2
+	echo "!!!!" >&2
+	echo "! You need to: " >&2
+	if [ "x$VIRTUAL_ENV" = "x" ] ; then
+	    echo "!   source $GEXT_VIRTUALENV_PYTHON/$GSDLOS/virtualenv-python3/bin/activate" >&2
+	    echo "! Then: " >&2
+	fi
+
+	if [ "$1" = "pyannote" ] ; then
+	    echo "! pip install https://github.com/pyannote/pyannote-audio/archive/develop.zip" >&2
+	else
+	    echo "!   pip install $1" >&2
+	fi
+	
+	echo "!" >&2
+	echo "!!!!" >&2
+	
+	return 1
+    fi
+}
+
+function check_pip_installed_all()
+{
+    for pkg in wheel ; do
+	check_pip_installed $pkg
+	if [ $? != 0 ] ; then
+	    return 1
+	fi
+    done
+}
+
+
+if [ "x$VIRTUAL_ENV" = "x" ] ; then
+
+    echo ""
+    echo "****"
+    echo "* Activating Python v3 Virtual Env "
+    echo "****"
+    echo ""
+
+    source $GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python3/bin/activate
+
+fi
+
+
+check_pip_installed_all
+    
+if [ $? != 0 ] ; then
+    return 1
+fi    
Index: /gs3-extensions/virtualenv-python/trunk/devel.bash
===================================================================
--- /gs3-extensions/virtualenv-python/trunk/devel.bash	(revision 36310)
+++ /gs3-extensions/virtualenv-python/trunk/devel.bash	(revision 36310)
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+_full_pyver_=$(python3 -V 2>&1 | grep -Po '(?<=Python )(.+)')
+_pyver_=${_full_pyver_%%.*}
+
+if [ "x$_pyver_" = "x" ]  ; then
+    echo "" >&2
+    echo "Failed to establish the full version of python" >&2
+    echo "Defaulting to version 3" >&2
+    _pyver_=3
+fi
+    
+
+if [ "x$GEXT_VIRTUALENV_PYTHON" = "x" ] ; then
+  source ./setup.bash
+fi
+
+if [ ! -f "$GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python$_pyver_/bin/activate" ] ; then
+    echo "" >&2
+    echo "!!!!" >&2
+    echo "! Failed to find:" >&2
+    echo "!   $GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python$_pyver_/bin/activate" >&2
+    echo "!" >&2
+    echo "! Have you run:" >&2
+    echo "!   ./CREATE-VEN-PYTHON$_pyver_.sh" >&2
+    echo "!" >&2
+    echo "! Followed by:" >&2
+    echo "!   source $GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python$_pyver_/bin/activate" >&2
+    echo "!!!!" >&2
+    echo "" >&2
+
+    # Uncomment the following if you want to stop everything immediately
+    #
+    # While it is commented out, it means the issue is flagged, but 
+    # allows for the circumstance that the developer is (for some reason)
+    # needing to make use of a version of python outside of this extension's area
+    # 
+    # return 1
+
+elif [ "$VIRTUAL_ENV" != "$GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python$_pyver_" ] ; then
+    # A python virtual env is in play, but not the one for Python v$_pyver_ in this extension's area
+    echo ""
+    echo "****"
+    echo "* Warning: VIRTUAL_ENV points to different location to the one in $GEXT_VIRTUALENV_PYTHON"
+    echo "*   VIRTUAL_ENV      = $VIRTUAL_ENV"
+    echo "*   Extension's python$_pyver_ = $GEXT_VIRTUALENV_PYTHON_INSTALLED/virtualenv-python$_pyver_"
+    echo "****"
+    echo ""
+fi
+
+export GEXT_VIRTUALENV_PYTHON_DEVEL=1
+    
+
Index: /gs3-extensions/virtualenv-python/trunk/setup.bash
===================================================================
--- /gs3-extensions/virtualenv-python/trunk/setup.bash	(revision 36310)
+++ /gs3-extensions/virtualenv-python/trunk/setup.bash	(revision 36310)
@@ -0,0 +1,59 @@
+
+extdesc="the Virtualenv Python Extension"
+
+full_setup=`pwd`/${BASH_SOURCE}
+fulldir=${full_setup%/*}
+fulldir=${fulldir%/.}
+
+if [ "x$GSDLHOME" = "x" ] ; then
+  if [ -e ../../gs3-setup.sh ] ; then
+    export gsopt_noexts=1 && pushd ../.. && source ./gs3-setup.sh && popd 
+    export gsopt_noexts=
+  elif [ -e ../../setup.bash ] ; then
+    export gsopt_noexts=1 && pushd ../.. && source ./setup.bash && popd 
+    export gsopt_noexts=
+  else
+    # backstop
+    GSDLOS=`uname -s | tr '[A-Z]' '[a-z]'`
+    # check for running bash under cygwin
+    if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ; then
+      GSDLOS=windows
+    fi 
+
+  fi
+fi
+
+if [ "x$GEXT_VIRTUALENV_PYTHON" = "x" ] ; then
+  export GEXT_VIRTUALENV_PYTHON=$fulldir
+  export GEXT_VIRTUALENV_PYTHON_INSTALLED=$GEXT_VIRTUALENV_PYTHON/$GSDLOS
+
+#  export PATH=$GEXT_VIRTUALENV_PYTHON_INSTALLED/bin:$GEXT_VIRTUALENV_PYTHON/bin/script:$PATH
+#
+#  if [ "x$LD_LIBRARY_PATH" = "x" ] ; then
+#    export LD_LIBRARY_PATH=$GEXT_VIRTUALENV_PYTHON_INSTALLED/lib
+#  else
+#    export LD_LIBRARY_PATH=$GEXT_VIRTUALENV_PYTHON_INSTALLED/lib:$LD_LIBRARY_PATH
+#  fi
+#  if [ "x$DYLD_LIBRARY_PATH" = "x" ] ; then
+#    export DYLD_LIBRARY_PATH=$GEXT_VIRTUALENV_PYTHON_INSTALLED/lib
+#  else
+#    export DYLD_LIBRARY_PATH=$GEXT_VIRTUALENV_PYTHON_INSTALLED/lib:$DYLD_LIBRARY_PATH
+#  fi
+# if [ "x$PKG_CONFIG_PATH" = "x" ] ; then
+#    export PKG_CONFIG_PATH=$GEXT_VIRTUALENV_PYTHON_INSTALLED/pkgconfig
+#  else
+#    export PKG_CONFIG_PATH=$GEXT_VIRTUALENV_PYTHON_INSTALLED/pkgconfig:$PKG_CONFIG_PATH
+#  fi
+
+  extdir=${GEXT_VIRTUALENV_PYTHON##*/}
+
+  if [ "x$GSDLEXTS" = "x" ] ; then
+    export GSDLEXTS=$extdir
+  else 
+    export GSDL3EXTS=$GSDL3EXTS:$extdir
+  fi
+
+  echo "+Your environment is now setup for $extdesc"
+else
+  echo "+Your environment is already setup for $extdesc"
+fi
