mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Pack project: Raise exception with reasonable message (#5145)
* raise exception with reasonable message * raise errors at better places
This commit is contained in:
parent
59b7e265da
commit
22296aeb6e
2 changed files with 18 additions and 0 deletions
|
|
@ -113,6 +113,12 @@ def pack_project(
|
|||
project_name
|
||||
))
|
||||
|
||||
if only_documents and not destination_dir:
|
||||
raise ValueError((
|
||||
"Destination directory must be defined"
|
||||
" when only documents should be packed."
|
||||
))
|
||||
|
||||
root_path = None
|
||||
source_root = {}
|
||||
project_source_path = None
|
||||
|
|
@ -141,6 +147,11 @@ def pack_project(
|
|||
if not destination_dir:
|
||||
destination_dir = root_path
|
||||
|
||||
if not destination_dir:
|
||||
raise ValueError(
|
||||
"Project {} does not have any roots.".format(project_name)
|
||||
)
|
||||
|
||||
destination_dir = os.path.normpath(destination_dir)
|
||||
if not os.path.exists(destination_dir):
|
||||
os.makedirs(destination_dir)
|
||||
|
|
|
|||
|
|
@ -356,6 +356,13 @@ class PypeCommands:
|
|||
def pack_project(self, project_name, dirpath, database_only):
|
||||
from openpype.lib.project_backpack import pack_project
|
||||
|
||||
if database_only and not dirpath:
|
||||
raise ValueError((
|
||||
"Destination dir must be defined when using --dbonly."
|
||||
" Use '--dirpath {output dir path}' flag"
|
||||
" to specify directory."
|
||||
))
|
||||
|
||||
pack_project(project_name, dirpath, database_only)
|
||||
|
||||
def unpack_project(self, zip_filepath, new_root, database_only):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue