From f17ab41dc46e9eb61a06a71baeebec07775aff47 Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes@redhat.com>
Date: Wed, 11 Jul 2018 11:58:40 +0200
Subject: [PATCH] pylint 2.0: node.path is a list

In pylint 2.0 and astroid 2.0, node.path has become a list. It's usually
a list of one element unless namespace packages are involved.

See https://github.com/PyCQA/astroid/commit/7f46f9341cc54bbe6763409c4ca7ea3adfec098a#diff-f0ac879524bcb98964f7d8738a084820

See: https://pagure.io/freeipa/issue/7614
Signed-off-by: Christian Heimes <cheimes@redhat.com>
---
 pylint_plugins.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pylint_plugins.py b/pylint_plugins.py
index e7a5c7f4e7..c429603d60 100644
--- a/pylint_plugins.py
+++ b/pylint_plugins.py
@@ -363,6 +363,11 @@ def open(self):
 
     def _get_forbidden_import_rule(self, node):
         path = node.path
+        if path and isinstance(path, list):
+            # In pylint 2.0, path is a list with one element. Namespace
+            # packages may contain more than one element, but we can safely
+            # ignore them, as they don't contain code.
+            path = path[0]
         if path:
             path = os.path.abspath(path)
             while path.startswith(self._dir):
