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

ash pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 37ca990  Don't check for `__init__.py` under pycache folders. (#18238)
37ca990 is described below

commit 37ca9904f27df4184c3f49bd4917635cd6987b47
Author: Ash Berlin-Taylor <[email protected]>
AuthorDate: Tue Sep 14 13:03:25 2021 +0100

    Don't check for `__init__.py` under pycache folders. (#18238)
    
    Otherwise we end up with errors like this from pre-commit:
    
    ```
    No __init__.py file was found in the following provider directories:
    /home/ash/code/airflow/airflow/airflow/providers/airbyte/__pycache__
    /home/ash/code/airflow/airflow/airflow/providers/airbyte/hooks/__pycache__
    
/home/ash/code/airflow/airflow/airflow/providers/airbyte/operators/__pycache__
    ```
---
 .../pre_commit_check_providers_subpackages_all_have_init.py       | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/scripts/ci/pre_commit/pre_commit_check_providers_subpackages_all_have_init.py 
b/scripts/ci/pre_commit/pre_commit_check_providers_subpackages_all_have_init.py
index 0d06dc8..44cf5ac1 100755
--- 
a/scripts/ci/pre_commit/pre_commit_check_providers_subpackages_all_have_init.py
+++ 
b/scripts/ci/pre_commit/pre_commit_check_providers_subpackages_all_have_init.py
@@ -26,9 +26,11 @@ ROOT_DIR = 
os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os
 
 def check_dir_init_file(provider_files: List[str]) -> None:
     missing_init_dirs = []
-    for dags_file in provider_files:
-        if os.path.isdir(dags_file) and not 
os.path.exists(os.path.join(dags_file, "__init__.py")):
-            missing_init_dirs.append(dags_file)
+    for path in provider_files:
+        if path.endswith("/__pycache__"):
+            continue
+        if os.path.isdir(path) and not os.path.exists(os.path.join(path, 
"__init__.py")):
+            missing_init_dirs.append(path)
 
     if missing_init_dirs:
         with open(os.path.join(ROOT_DIR, "license-templates/LICENSE.txt")) as 
license:

Reply via email to