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

jianliangqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 634292ec1df [Enhancement](build support) make run_clang_format 
compatible with python3 (#28404)
634292ec1df is described below

commit 634292ec1df5ef186ef49ae3e51d8f5a667d4e57
Author: airborne12 <airborn...@gmail.com>
AuthorDate: Thu Dec 14 16:02:47 2023 +0800

    [Enhancement](build support) make run_clang_format compatible with python3 
(#28404)
    
    run_clang_format.py in python3 env will produce error like 
"ModuleNotFoundError: No module named 'distutils.util' ", try to fix this.
---
 build-support/run_clang_format.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/build-support/run_clang_format.py 
b/build-support/run_clang_format.py
index 6ce898c298f..266c7d5384f 100755
--- a/build-support/run_clang_format.py
+++ b/build-support/run_clang_format.py
@@ -23,7 +23,25 @@ import signal
 import subprocess
 import sys
 import traceback
-from distutils.util import strtobool
+try:
+    from distutils.util import strtobool
+except ImportError:
+    def strtobool(val):
+        """
+        Convert a string representation of truth to true (1) or false (0).
+
+        True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
+        are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
+        'val' is anything else.
+        """
+        val = val.lower()
+        if val in ('y', 'yes', 't', 'true', 'on', '1'):
+            return 1
+        elif val in ('n', 'no', 'f', 'false', 'off', '0'):
+            return 0
+        else:
+            raise ValueError(f"Invalid truth value '{val}'")
+
 
 from functools import partial
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to