skip roots validation for documents only variant of the functions

This commit is contained in:
Jakub Trllo 2023-06-01 15:48:52 +02:00
parent ed35b2ecfb
commit aab6e19b5e

View file

@ -113,26 +113,29 @@ def pack_project(
project_name project_name
)) ))
roots = project_doc["config"]["roots"] root_path = None
# Determine root directory of project source_root = {}
source_root = None project_source_path = None
source_root_name = None if not only_documents:
for root_name, root_value in roots.items(): roots = project_doc["config"]["roots"]
if source_root is not None: # Determine root directory of project
raise ValueError( source_root_name = None
"Packaging is supported only for single root projects" for root_name, root_value in roots.items():
) if source_root is not None:
source_root = root_value raise ValueError(
source_root_name = root_name "Packaging is supported only for single root projects"
)
source_root = root_value
source_root_name = root_name
root_path = source_root[platform.system().lower()] root_path = source_root[platform.system().lower()]
print("Using root \"{}\" with path \"{}\"".format( print("Using root \"{}\" with path \"{}\"".format(
source_root_name, root_path source_root_name, root_path
)) ))
project_source_path = os.path.join(root_path, project_name) project_source_path = os.path.join(root_path, project_name)
if not os.path.exists(project_source_path): if not os.path.exists(project_source_path):
raise ValueError("Didn't find source of project files") raise ValueError("Didn't find source of project files")
# Determine zip filepath where data will be stored # Determine zip filepath where data will be stored
if not destination_dir: if not destination_dir:
@ -273,8 +276,7 @@ def unpack_project(
low_platform = platform.system().lower() low_platform = platform.system().lower()
project_name = metadata["project_name"] project_name = metadata["project_name"]
source_root = metadata["root"] root_path = metadata["root"].get(low_platform)
root_path = source_root[low_platform]
# Drop existing collection # Drop existing collection
replace_project_documents(project_name, docs, database_name) replace_project_documents(project_name, docs, database_name)