You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/09/10 09:06:44 UTC

[GitHub] XD-DENG closed pull request #3662: [AIRFLOW-2818] Handle DAG File with Upper Case Extension

XD-DENG closed pull request #3662: [AIRFLOW-2818] Handle DAG File with Upper Case Extension
URL: https://github.com/apache/incubator-airflow/pull/3662
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/models.py b/airflow/models.py
index cf7eb0a64f..ecdd5420ba 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -372,7 +372,7 @@ def process_file(self, filepath, only_if_updated=True, safe_mode=True):
             for mod in zip_file.infolist():
                 head, _ = os.path.split(mod.filename)
                 mod_name, ext = os.path.splitext(mod.filename)
-                if not head and (ext == '.py' or ext == '.pyc'):
+                if not head and (ext.lower() == '.py' or ext.lower() == '.pyc'):
                     if mod_name == '__init__':
                         self.log.warning("Found __init__.%s at root of %s", ext, filepath)
                     if safe_mode:
diff --git a/airflow/plugins_manager.py b/airflow/plugins_manager.py
index 735f2de1e8..8f7c8f99d9 100644
--- a/airflow/plugins_manager.py
+++ b/airflow/plugins_manager.py
@@ -76,7 +76,7 @@ def validate(cls):
                 continue
             mod_name, file_ext = os.path.splitext(
                 os.path.split(filepath)[-1])
-            if file_ext != '.py':
+            if file_ext.lower() != '.py':
                 continue
 
             log.debug('Importing plugin module %s', filepath)
diff --git a/airflow/utils/dag_processing.py b/airflow/utils/dag_processing.py
index e236397da0..b21bbe7883 100644
--- a/airflow/utils/dag_processing.py
+++ b/airflow/utils/dag_processing.py
@@ -208,7 +208,7 @@ def list_py_file_paths(directory, safe_mode=True):
                         continue
                     mod_name, file_ext = os.path.splitext(
                         os.path.split(file_path)[-1])
-                    if file_ext != '.py' and not zipfile.is_zipfile(file_path):
+                    if file_ext.lower() != '.py' and not zipfile.is_zipfile(file_path):
                         continue
                     if any([re.findall(p, file_path) for p in patterns]):
                         continue
diff --git a/tests/jobs.py b/tests/jobs.py
index 93f6574df4..0e038aa490 100644
--- a/tests/jobs.py
+++ b/tests/jobs.py
@@ -3167,7 +3167,7 @@ def test_list_py_file_paths(self):
         detected_files = []
         expected_files = []
         for file_name in os.listdir(TEST_DAGS_FOLDER):
-            if file_name.endswith('.py') or file_name.endswith('.zip'):
+            if file_name.lower().endswith('.py') or file_name.lower().endswith('.zip'):
                 if file_name not in ['no_dags.py']:
                     expected_files.append(
                         '{}/{}'.format(TEST_DAGS_FOLDER, file_name))


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services