Skip to content

Commit

Permalink
Don't check for __init__.py under pycache folders. (apache#18238)
Browse files Browse the repository at this point in the history
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__
```
  • Loading branch information
ashb committed Sep 14, 2021
1 parent 7a19124 commit 37ca990
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@

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:
Expand Down

0 comments on commit 37ca990

Please sign in to comment.