You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/12/06 20:17:00 UTC

[airflow] branch v1-10-stable updated: Bugfix: Unable to import Airflow plugins on Python 3.8 (#12859)

This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v1-10-stable
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v1-10-stable by this push:
     new 3c9c7ab  Bugfix: Unable to import Airflow plugins on Python 3.8 (#12859)
3c9c7ab is described below

commit 3c9c7ab023965f9249c970c7cbecd4a2ae43d621
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Sun Dec 6 20:15:56 2020 +0000

    Bugfix: Unable to import Airflow plugins on Python 3.8 (#12859)
    
    closes https://github.com/apache/airflow/issues/12855
---
 airflow/plugins_manager.py                 | 6 +++---
 setup.py                                   | 2 +-
 tests/plugins/test_plugins_manager_rbac.py | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/airflow/plugins_manager.py b/airflow/plugins_manager.py
index a20126f..8ec0b4c 100644
--- a/airflow/plugins_manager.py
+++ b/airflow/plugins_manager.py
@@ -35,9 +35,9 @@ from typing import Any, Dict, List, Type
 from six import with_metaclass
 
 try:
-    import importlib.metadata as importlib_metadata
-except ImportError:
     import importlib_metadata
+except ImportError:
+    import importlib.metadata as importlib_metadata
 
 from airflow import settings
 from airflow.models.baseoperator import BaseOperatorLink
@@ -157,7 +157,7 @@ def load_entrypoint_plugins(entry_points, airflow_plugins):
                 airflow_plugins.append(plugin_obj)
         except Exception as e:  # pylint: disable=broad-except
             log.exception("Failed to import plugin %s", entry_point.name)
-            import_errors[entry_point.module_name] = str(e)
+            import_errors[entry_point.module] = str(e)
     return airflow_plugins
 
 
diff --git a/setup.py b/setup.py
index a23d45c..20b78b8 100644
--- a/setup.py
+++ b/setup.py
@@ -439,7 +439,7 @@ devel = [
     'freezegun',
     'gitpython',
     'idna<2.9',  # Required for moto 1.3.14
-    'importlib-metadata~=2.0; python_version<"3.8"',
+    'importlib-metadata~=2.0; python_version<"3.9"',
     'ipdb',
     'jira',
     'mock;python_version<"3.3"',
diff --git a/tests/plugins/test_plugins_manager_rbac.py b/tests/plugins/test_plugins_manager_rbac.py
index c2ca805..bd50463 100644
--- a/tests/plugins/test_plugins_manager_rbac.py
+++ b/tests/plugins/test_plugins_manager_rbac.py
@@ -87,7 +87,7 @@ class TestPluginsRBAC(object):
         mock_entrypoint = mock.Mock()
         mock_entrypoint.name = 'test-entrypoint'
         mock_entrypoint.group = 'airflow.plugins'
-        mock_entrypoint.module_name = 'test.plugins.test_plugins_manager'
+        mock_entrypoint.module = 'test.plugins.test_plugins_manager'
         mock_entrypoint.load.side_effect = ImportError('my_fake_module not found')
         mock_dist.entry_points = [mock_entrypoint]