diff --git a/pype/cli.py b/pype/cli.py index e07786e76a..1f7834a91e 100644 --- a/pype/cli.py +++ b/pype/cli.py @@ -23,6 +23,7 @@ def main(ctx): @main.command() @click.option("-d", "--dev", is_flag=True, help="Settings in Dev mode") def settings(dev=False): + """Show Pype Settings UI.""" PypeCommands().launch_settings_gui(dev) @@ -280,7 +281,7 @@ def generate_zip(path): allow_extra_args=True)) @click.argument("script", required=True, type=click.Path(exists=True)) def run(script): - """Run python script.""" + """Run python script in Pype context.""" import runpy if not script: diff --git a/tools/build.ps1 b/tools/build.ps1 index a233281585..389846d8ea 100644 --- a/tools/build.ps1 +++ b/tools/build.ps1 @@ -98,9 +98,22 @@ if (-not $pype_version) { Exit-WithCode 1 } +# Create build directory if not exist +if (-not (Test-Path -PathType Container -Path "$($pype_root)\build")) { + New-Item -ItemType Directory -Force -Path "$($pype_root)\build" +} + Write-Host "--- " -NoNewline -ForegroundColor yellow Write-Host "Cleaning build directory ..." -Remove-Item -Recurse -Force "$($pype_root)\build\*" +try { + Remove-Item -Recurse -Force "$($pype_root)\build\*" +} +catch { + Write-Host "!!! " -NoNewline -ForegroundColor Red + Write-Host "Cannot clean build directory, possibly because process is using it." + Write-Host $_.Exception.Message + Exit-WithCode 1 +} Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Building Pype [ " -NoNewline -ForegroundColor white diff --git a/tools/create_env.ps1 b/tools/create_env.ps1 index 7354ee72ed..1fee947a38 100644 --- a/tools/create_env.ps1 +++ b/tools/create_env.ps1 @@ -87,9 +87,24 @@ if(($matches[1] -lt 3) -or ($matches[2] -lt 7)) { } Write-Host "OK [ $p ]" -ForegroundColor green +# Create venv directory if not exist +if (-not (Test-Path -PathType Container -Path "$($pype_root)\venv")) { + New-Item -ItemType Directory -Force -Path "$($pype_root)\venv" +} + Write-Host "--- " -NoNewline -ForegroundColor yellow Write-Host "Cleaning venv directory ..." -Remove-Item -Recurse -Force "$($pype_root)\venv\*" + +try { + Remove-Item -Recurse -Force "$($pype_root)\venv\*" +} +catch { + Write-Host "!!! " -NoNewline -ForegroundColor red + Write-Host "Cannot clean venv directory, possibly another process is using it." + Write-Host $_.Exception.Message + Exit-WithCode 1 +} + Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Creating virtual env ..."