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

potiuk pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 672959cd759dd683fb920f45d100de20ef76351d
Author: Kamil BreguĊ‚a <[email protected]>
AuthorDate: Thu Jul 15 09:39:23 2021 +0200

    Fix bug and small improvements in scripts/tools/list-integrations.py 
(#17004)
    
    (cherry picked from commit 364518432751f0e8c54a742f526c0ffbc216576b)
---
 scripts/tools/list-integrations.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/tools/list-integrations.py 
b/scripts/tools/list-integrations.py
index 3df6151..5a5822e 100755
--- a/scripts/tools/list-integrations.py
+++ b/scripts/tools/list-integrations.py
@@ -29,10 +29,12 @@ from airflow.models.baseoperator import BaseOperator
 from airflow.secrets import BaseSecretsBackend
 from airflow.sensors.base import BaseSensorOperator
 
+program = f"./{__file__}" if not __file__.startswith("./") else __file__
+
 if __name__ != "__main__":
     raise Exception(
-        "This file is intended to be executed as an executable program. You 
cannot use it as a module."
-        "To run this script, run the './list-integrations.py' command"
+        "This file is intended to be used as an executable program. You cannot 
use it as a module."
+        f"To execute this script, run the '{program}' command"
     )
 
 AIRFLOW_ROOT = os.path.abspath(os.path.join(os.path.dirname(airflow.__file__), 
os.pardir))
@@ -66,8 +68,6 @@ def _find_clazzes(directory, base_class):
     return found_classes
 
 
-program = "./" + os.path.basename(sys.argv[0])
-
 HELP = """\
 List operators, hooks, sensors, secrets backend in the installed Airflow.
 
@@ -96,7 +96,7 @@ If you want to count the operators/sensors in each providers 
package, you can us
 """
 
 parser = argparse.ArgumentParser(
-    description=HELP, formatter_class=argparse.RawTextHelpFormatter, 
epilog=EPILOG
+    prog=program, description=HELP, 
formatter_class=argparse.RawTextHelpFormatter, epilog=EPILOG
 )
 # argparse handle `-h/--help/` internally
 parser.parse_args()
@@ -115,5 +115,5 @@ for integration_base_directory, integration_class in 
RESOURCE_TYPES.items():
         if "contrib" in integration_directory:
             continue
 
-        for clazz_to_print in sorted(_find_clazzes(integration_base_directory, 
integration_class)):
+        for clazz_to_print in sorted(_find_clazzes(integration_directory, 
integration_class)):
             print(clazz_to_print)

Reply via email to