ashb commented on a change in pull request #12082:
URL: https://github.com/apache/airflow/pull/12082#discussion_r517990162



##########
File path: scripts/in_container/run_test_package_import_all_classes.sh
##########
@@ -78,7 +78,29 @@ echo
 echo  Importing all classes in Airflow 1.10
 echo
 
+unset PYTHONPATH
 # We need to make sure we are not in the airflow checkout, otherwise it will 
automatically be added to the
 # import path
 cd /
-python3 /import_all_provider_classes.py
+
+PATHS_TO_SEARCH_PROVIDERS_IN=$(python3 <<EOF 2>/dev/null
+import airflow.providers;
+path=airflow.providers.__path__
+for p in path._path:
+    print(p)
+EOF
+)
+
+readonly PATHS_TO_SEARCH_PROVIDERS_IN
+
+echo "Searching for providers packages in:"
+echo "${PATHS_TO_SEARCH_PROVIDERS_IN}"
+
+declare -a IMPORT_CLASS_PARAMETERS
+
+while IFS= read -r line <(echo "${PATHS_TO_SEARCH_PROVIDERS_IN}")
+do
+    IMPORT_CLASS_PARAMETERS+=("--path" "${path}")
+done

Review comment:
       ```suggestion
   IFS=$'\n' PATHS_TO_SEARCH_PROVIDERS_IN=($(python3 <<EOF 2>/dev/null
   import airflow.providers;
   path=airflow.providers.__path__
   for p in path._path:
       print(p)
   EOF
   ))
   
   readonly PATHS_TO_SEARCH_PROVIDERS_IN
   
   echo "Searching for providers packages in:"
   echo "${PATHS_TO_SEARCH_PROVIDERS_IN}"
   
   declare -a IMPORT_CLASS_PARAMETERS
   
   for path in  "${PATHS_TO_SEARCH_PROVIDERS_IN[@]}"
   do
       IMPORT_CLASS_PARAMETERS+=("--path" "${path}")
   done
   ```
   
   You also had a typo - `read -r line` but using `${path}` --you should add 
`set -u` to this file.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to