check for build and venv dirs

This commit is contained in:
Ondřej Samohel 2021-01-13 10:44:38 +01:00 committed by Ondrej Samohel
parent b88f2a8461
commit 47b4385947
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
3 changed files with 32 additions and 3 deletions

View file

@ -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:

View file

@ -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

View file

@ -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 ..."