stale[bot] closed pull request #2754: [AIRFLOW-1729] Ignore whole directories
from .airflowignore
URL: https://github.com/apache/incubator-airflow/pull/2754
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/utils/dag_processing.py b/airflow/utils/dag_processing.py
index 68cee7601e..67502b0d6e 100644
--- a/airflow/utils/dag_processing.py
+++ b/airflow/utils/dag_processing.py
@@ -174,11 +174,11 @@ def list_py_file_paths(directory, safe_mode=True):
elif os.path.isdir(directory):
patterns = []
for root, dirs, files in os.walk(directory, followlinks=True):
- ignore_file = [f for f in files if f == '.airflowignore']
- if ignore_file:
- f = open(os.path.join(root, ignore_file[0]), 'r')
- patterns += [p for p in f.read().split('\n') if p]
- f.close()
+ if '.airflowignore' in files:
+ with open(os.path.join(root, '.airflowignore'), 'r') as f:
+ patterns += [p for p in f if p]
+ dirs[:] = [d for d in dirs if not any(
+ [re.findall(p, os.path.join(root, d)) for p in patterns])]
for f in files:
try:
file_path = os.path.join(root, f)
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services