From ccc8fceb6bd83ffbf6e5207247fb8f76fc47a5b6 Mon Sep 17 00:00:00 2001
From: Dalai Felinto <dalai@blender.org>
Date: Thu, 19 May 2022 11:12:36 +0200
Subject: [PATCH] autopep8 parser: Fix parser when no autopep8 is installed

Differential Revision: https://developer.blender.org/D14983
---
 utils_maintenance/autopep8_format_paths.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utils_maintenance/autopep8_format_paths.py b/utils_maintenance/autopep8_format_paths.py
index a5647b7..c0eb367 100755
--- a/utils_maintenance/autopep8_format_paths.py
+++ b/utils_maintenance/autopep8_format_paths.py
@@ -68,6 +68,7 @@ def autopep8_ensure_version(autopep8_format_cmd_argument):
     global AUTOPEP8_FORMAT_CMD
     autopep8_format_cmd = None
     version_output = None
+    version = None
     # Attempt to use `--autopep8-command` passed in from `make format`
     # so the autopep8 distributed with Blender will be used.
     for is_default in (True, False):
@@ -90,7 +91,8 @@ def autopep8_ensure_version(autopep8_format_cmd_argument):
             continue
         AUTOPEP8_FORMAT_CMD = autopep8_format_cmd
         break
-    version = next(iter(v for v in version_output.split() if v[0].isdigit()), None)
+    if version_output is not None:
+        version = next(iter(v for v in version_output.split() if v[0].isdigit()), None)
     if version is not None:
         version = version.split("-")[0]
         version = tuple(int(n) for n in version.split("."))
-- 
GitLab