From 975538a7a7757b09a08c8a8b377a4055258ff32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Fri, 24 Apr 2020 15:12:41 +0200 Subject: [PATCH] make yamllint optional --- fdroidserver/common.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 23942b49..c6ca2fb8 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -42,8 +42,6 @@ import urllib.request import zipfile import tempfile import json -import yamllint.config -import yamllint.linter # TODO change to only import defusedxml once its installed everywhere try: @@ -3745,6 +3743,13 @@ YAML_LINT_CONFIG = {'extends': 'default', def run_yamllint(path, indent=0): + + try: + import yamllint.config + import yamllint.linter + except ImportError: + return '' + result = [] with open(path, 'r', encoding='utf-8') as f: problems = yamllint.linter.run(f, yamllint.config.YamlLintConfig(json.dumps(YAML_LINT_CONFIG)))