From 05c598c75e8541afb70da5a69f695fce5a5fe10b Mon Sep 17 00:00:00 2001 From: Mark Gomersbach Date: Thu, 1 Nov 2018 15:05:16 +0100 Subject: [PATCH] Fix import error by utilizing six and strict version spec --- salt/modules/ebuild.py | 12 ++++-------- salt/utils/virtualbox.py | 14 +++++--------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/salt/modules/ebuild.py b/salt/modules/ebuild.py index 40de5ea40b..08b608f218 100644 --- a/salt/modules/ebuild.py +++ b/salt/modules/ebuild.py @@ -19,14 +19,6 @@ from __future__ import absolute_import import copy import logging import re -try: - if globals()['__builtins__'].reload: - pass -except AttributeError: - try: - from importlib import reload - except ImportError: - from imp import reload # Import salt libs import salt.utils @@ -35,6 +27,10 @@ import salt.utils.systemd from salt.exceptions import CommandExecutionError, MinionError import salt.ext.six as six +# Workaround for 'reload' builtin of py2.7 +if six.PY3: + from importlib import reload + # Import third party libs HAS_PORTAGE = False try: diff --git a/salt/utils/virtualbox.py b/salt/utils/virtualbox.py index 77a331acb5..d8e39c59e9 100644 --- a/salt/utils/virtualbox.py +++ b/salt/utils/virtualbox.py @@ -13,17 +13,13 @@ import logging import re import time -try: - if globals()['__builtins__'].reload: - pass -except AttributeError: - try: - from importlib import reload - except ImportError: - from imp import reload - # Import salt libs from salt.utils.timeout import wait_for +import salt.ext.six as six + +# Workaround for 'reload' builtin of py2.7 +if six.PY3: + from importlib import reload log = logging.getLogger(__name__)