clean zips files, fix shared version location

This commit is contained in:
Ondrej Samohel 2021-05-17 18:08:15 +02:00 committed by Ondřej Samohel
parent 67b7e8071f
commit 33df862d1d
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
3 changed files with 25 additions and 6 deletions

View file

@ -622,7 +622,7 @@ class BootstrapRepos:
" not implemented yet."))
dir_to_search = self.data_dir
user_versions = self.get_openpype_versions(self.data_dir, staging)
# if we have openpype_path specified, search only there.
if openpype_path:
dir_to_search = openpype_path
@ -642,6 +642,7 @@ class BootstrapRepos:
pass
openpype_versions = self.get_openpype_versions(dir_to_search, staging)
openpype_versions += user_versions
# remove zip file version if needed.
if not include_zips:
@ -754,12 +755,13 @@ class BootstrapRepos:
destination = self.data_dir / version.path.stem
if destination.exists():
assert destination.is_dir()
try:
destination.unlink()
except OSError:
shutil.rmtree(destination)
except OSError as e:
msg = f"!!! Cannot remove already existing {destination}"
self._print(msg, LOG_ERROR, exc_info=True)
return None
raise e
destination.mkdir(parents=True)

View file

@ -427,6 +427,13 @@ def _find_frozen_openpype(use_version: str = None,
path=Path(os.environ["OPENPYPE_ROOT"]))
if local_version not in openpype_versions:
openpype_versions.append(local_version)
openpype_versions.sort()
# if latest is currently running, ditch whole list
# and run from current without installing it.
if local_version == openpype_versions[-1]:
os.environ["OPENPYPE_TRYOUT"] = "1"
openpype_versions = []
else:
print("!!! Warning: cannot determine current running version.")
@ -502,7 +509,15 @@ def _find_frozen_openpype(use_version: str = None,
if openpype_version.path.is_file():
print(">>> Extracting zip file ...")
version_path = bootstrap.extract_openpype(openpype_version)
try:
version_path = bootstrap.extract_openpype(openpype_version)
except OSError as e:
print("!!! failed: {}".format(str(e)))
sys.exit(1)
else:
# cleanup zip after extraction
os.unlink(openpype_version.path)
openpype_version.path = version_path
_initialize_environment(openpype_version)

View file

@ -164,6 +164,7 @@ Write-Host "OK" -ForegroundColor green
Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "Building OpenPype ..."
$startTime = (Get-Date).Millisecond
$out = & poetry run python setup.py build 2>&1
if ($LASTEXITCODE -ne 0)
@ -182,7 +183,8 @@ Write-Host ">>> " -NoNewline -ForegroundColor green
Write-Host "restoring current directory"
Set-Location -Path $current_dir
$endTime = (Get-Date).Millisecond
Write-Host "*** " -NoNewline -ForegroundColor Cyan
Write-Host "All done. You will find OpenPype and build log in " -NoNewLine
Write-Host "All done in $($endTime - $startTime) secs. You will find OpenPype and build log in " -NoNewLine
Write-Host "'.\build'" -NoNewline -ForegroundColor Green
Write-Host " directory."