diff --git a/swh/vault/cli.py b/swh/vault/cli.py --- a/swh/vault/cli.py +++ b/swh/vault/cli.py @@ -70,7 +70,6 @@ and outputs it to the given file. """ from swh.core import config - from swh.graph.client import RemoteGraphClient from swh.objstorage.factory import get_objstorage from swh.storage import get_storage @@ -101,10 +100,16 @@ f"an explicit --cooker-type." ) + try: + from swh.graph.client import RemoteGraphClient + + graph = RemoteGraphClient(**conf["graph"]) if "graph" in conf else None + except ImportError: # graph is not supported yet + graph = None + backend = InMemoryVaultBackend() storage = get_storage(**conf["storage"]) objstorage = get_objstorage(**conf["objstorage"]) if "objstorage" in conf else None - graph = RemoteGraphClient(**conf["graph"]) if "graph" in conf else None cooker_cls = get_cooker_cls(cooker_name) cooker = cooker_cls( obj_type=cooker_name, diff --git a/swh/vault/cookers/__init__.py b/swh/vault/cookers/__init__.py --- a/swh/vault/cookers/__init__.py +++ b/swh/vault/cookers/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2020 The Software Heritage developers +# Copyright (C) 2017-2021 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -10,7 +10,6 @@ from swh.core.config import load_named_config from swh.core.config import read as read_config -from swh.graph.client import RemoteGraphClient from swh.storage import get_storage from swh.vault import get_vault from swh.vault.cookers.base import DEFAULT_CONFIG, DEFAULT_CONFIG_PATH @@ -90,7 +89,13 @@ storage = get_storage(**vcfg.pop("storage")) backend = get_vault(**vcfg) - graph = RemoteGraphClient(**vcfg["graph"]) if "graph" in vcfg else None + + try: + from swh.graph.client import RemoteGraphClient + + graph = RemoteGraphClient(**vcfg["graph"]) if "graph" in vcfg else None + except ImportError: # graph is not supported yet + graph = None return cooker_cls( obj_type,