regisf / virtualenvwrapper-powershell

A mimic of the VirtualEnvWrapper project but with Powershell
MIT License
109 stars 28 forks source link

Temporary venv is not automatically removed #27

Open Gregor1337 opened 2 years ago

Gregor1337 commented 2 years ago

Hi, first of all, thanks a lot for creating this neat module.

I am trying to get the mktmpenv command to work, however, I think that the venv hook does not call the generated postdeactivate.ps1 script.

Asides, I changed the postdeactivate-script to

if (Test-Path -Path `"$dest_dir\README.tmpenv`") {
    Write-Host `"Removing temporary environment $uuid`"
    # Change the location else MS Windows will refuse to remove the directory
    Set-Location `"$WORKON_HOME`" 
    Remove-VirtualEnv `"$uuid`"
}

s.t. it correctly removes the tmp env when executed manually in a shell. Yet, the script is not executed when running deactivate within the tmp env.

Maybe you can say where you found documentation or source for the use of postdeactivate scripts with venv?

regisf commented 2 years ago

Hi @Gregor1337,

I have so many little time to work on ;) my project that I dropped the idea to implement this feature. You may see the branch implement-mktmpenv.

However, the way you solve the problem is interesting.

Unfortunatly, as far as I know there isn't a venv postdeactivate script.