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



##########
File path: dev/provider_packages/prepare_provider_packages.py
##########
@@ -1133,6 +1133,14 @@ def get_package_pip_name(provider_package_id: str, 
backport_packages: bool):
         return f"apache-airflow-providers-{provider_package_id.replace('.', 
'-')}"
 
 
+def get_provider_info(provider_package_id: str):
+    provider_yaml_file_name = 
os.path.join(get_source_package_path(provider_package_id), "provider.yaml")
+    if not os.path.exists(provider_yaml_file_name):
+        raise Exception(f"The provider.yaml file is missing: 
{provider_yaml_file_name}")
+    with open(provider_yaml_file_name) as provider_file:
+        return provider_file.read()

Review comment:
       ```suggestion
           return yaml.safe_load(provider_file)
   ```

##########
File path: dev/provider_packages/get_provider_info_TEMPLATE.py.jinja2
##########
@@ -0,0 +1,13 @@
+import yaml
+
+try:
+    import importlib.resources as importlib_resources
+except ImportError:
+    # Try backported to PY<37 `importlib_resources`.
+    import importlib_resources
+
+
+def get_provider_info():
+    return yaml.safe_load("""
+{{ PROVIDER_INFO }}
+""")

Review comment:
       ```suggestion
   def get_provider_info():
       {{ PROVIDER_INFO }}
   ```




----------------------------------------------------------------
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