You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2020/11/14 16:34:37 UTC

[airflow] 21/44: Use sys.exit() instead of exit() (#12084)

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

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

commit 2be4d56a78b2b49b08866ac9114a89ab5db7eef3
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Wed Nov 4 11:50:52 2020 +0000

    Use sys.exit() instead of exit() (#12084)
    
    The `exit` and `quit` functions are actually `site.Quitter` objects and are loaded, at interpreter start up, from site.py. However, if the interpreter is started with the `-S` flag, or a custom site.py is used then exit and quit may not be present. It is recommended to use `sys.exit()` which is built into the interpreter and is guaranteed to be present.
    
    (cherry picked from commit bec9f3b29fd42ecd1beae3db75784b9a726caf15)
---
 scripts/ci/pre_commit/pre_commit_check_setup_installation.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/ci/pre_commit/pre_commit_check_setup_installation.py b/scripts/ci/pre_commit/pre_commit_check_setup_installation.py
index 2fdeca6..b4f3281 100755
--- a/scripts/ci/pre_commit/pre_commit_check_setup_installation.py
+++ b/scripts/ci/pre_commit/pre_commit_check_setup_installation.py
@@ -22,6 +22,7 @@ Checks if all the libraries in setup.py are listed in installation.rst file
 
 import os
 import re
+import sys
 from os.path import dirname
 from typing import Dict, List
 
@@ -90,8 +91,8 @@ if __name__ == '__main__':
         if f"'{extras}'" not in setup_packages_str:
             output_table += "| {:20} | {:^10} | {:^10} |\n".format(extras, "", "V")
 
-    if(output_table == ""):
-        exit(0)
+    if output_table == "":
+        sys.exit(0)
 
     print(f"""
 ERROR
@@ -105,4 +106,4 @@ documented although not used.
     print(".{:_^22}.{:_^12}.{:_^12}.".format("NAME", "SETUP", "INSTALLATION"))
     print(output_table)
 
-    exit(1)
+    sys.exit(1)