diff --git a/divio_cli/cli.py b/divio_cli/cli.py index 6c09ac71..e8756362 100644 --- a/divio_cli/cli.py +++ b/divio_cli/cli.py @@ -14,7 +14,10 @@ from . import exceptions from . import localdev from . import messages -from . import crypto +try: + from . import crypto +except ImportError: + crypto = None from .localdev.utils import get_aldryn_project_settings from .cloud import CloudClient, get_endpoint from .check_system import check_requirements, check_requirements_human @@ -484,6 +487,13 @@ def backup(): @click.argument('destination', type=click.File('wb')) def backup_decrypt(key, backup, destination): """Decrypt a backup downloaded from Divio Cloud""" + if not crypto: + click.secho( + '\nPlease install the crypo extensions to use the crypto commands: ' + 'pip install divio-cli[crypto]', + fg='red' + ) + return key = base64.b64decode(key.read(1024).strip()) decryptor = crypto.StreamDecryptor(key=key) diff --git a/requirements.txt b/requirements.txt index fb84ee7b..2d06c02c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,5 @@ click requests tabulate six -cryptography attrs -yaml +pyaml diff --git a/setup.py b/setup.py index e86bbd6f..b863946e 100644 --- a/setup.py +++ b/setup.py @@ -42,6 +42,11 @@ license='BSD', platforms=['OS Independent'], install_requires=requirements, + extras_require={ + 'crypto': [ + 'cryptography', + ], + }, entry_points=""" [console_scripts] divio = divio_cli.cli:cli