Permalink
Browse files

activate.ps1: Move environment changes to after finding python.exe

This will leave the environment unmodified if python.exe can't be found.
  • Loading branch information...
Henri Wiechers
Henri Wiechers committed Nov 24, 2011
1 parent 519b8e9 commit 1ed4ea15e06ff31b670cfc957292634a212ac030
Showing with 11 additions and 13 deletions.
  1. +11 −13 bin/activate.ps1
View
@@ -41,18 +41,6 @@ function global:deactivate($nondestructive) {
deactivate $True;
-if (Test-Path Env:PYTHONPATH) {
- $Env:_OLD_PYTHONPATH = $Env:PYTHONPATH
-} else {
- $Env:_OLD_PYTHONPATH = 'NONE'
-};
-$Env:_OLD_VIRTUAL_PATH = $Env:PATH;
-
-$Env:VIRTUAL_ENV = (Get-Location);
-$Env:CUDDLEFISH_ROOT = $Env:VIRTUAL_ENV;
-$Env:PYTHONPATH = "$Env:VIRTUAL_ENV\python-lib;$Env:PYTHONPATH";
-$Env:PATH = "$Env:VIRTUAL_ENV\bin;$Env:PATH";
-
$script:PyInstallPathKey = (
@('HKCU:SOFTWARE\Python\PythonCore\*\InstallPath',
'HKLM:SOFTWARE\Python\PythonCore\*\InstallPath',
@@ -93,7 +81,17 @@ if (!$PyExePath) {
return;
}
-$Env:Path="$PyExeDir;$Env:Path"
+if (Test-Path Env:PYTHONPATH) {
+ $Env:_OLD_PYTHONPATH = $Env:PYTHONPATH
+} else {
+ $Env:_OLD_PYTHONPATH = 'NONE'
+};
+$Env:_OLD_VIRTUAL_PATH = $Env:PATH;
+
+$Env:VIRTUAL_ENV = (Get-Location);
+$Env:CUDDLEFISH_ROOT = $Env:VIRTUAL_ENV;
+$Env:PYTHONPATH = "$Env:VIRTUAL_ENV\python-lib;$Env:PYTHONPATH";
+$Env:PATH = "$PyExeDir;$Env:VIRTUAL_ENV\bin;$Env:PATH";
function global:_OLD_VIRTUAL_PROMPT {};
Set-Content Function:_OLD_VIRTUAL_PROMPT (Get-Content Function:Prompt);

0 comments on commit 1ed4ea1

Please sign in to comment.