From adf06b55ae783d171551bcfdf6918770d2693f99 Mon Sep 17 00:00:00 2001 From: mushroomfire <934313174@qq.com> Date: Tue, 23 Apr 2024 20:55:34 +0800 Subject: [PATCH 1/2] Fix bug to disable taichi header print --- python/taichi/_lib/utils.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/python/taichi/_lib/utils.py b/python/taichi/_lib/utils.py index 3f2add67e1edb..1eda5a426f4b6 100644 --- a/python/taichi/_lib/utils.py +++ b/python/taichi/_lib/utils.py @@ -82,7 +82,9 @@ def is_ci(): return os.environ.get("TI_CI", "") == "1" -package_root = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) +package_root = os.path.join( + os.path.dirname(os.path.dirname(os.path.realpath(__file__))) +) def get_core_shared_object(): @@ -104,7 +106,9 @@ def print_yellow_bold(*args, **kwargs): def check_exists(src): if not os.path.exists(src): - raise FileNotFoundError(f'File "{src}" not exist. Installation corrupted or build incomplete?') + raise FileNotFoundError( + f'File "{src}" not exist. Installation corrupted or build incomplete?' + ) ti_python_core = import_ti_python_core() @@ -169,7 +173,7 @@ def _print_taichi_header(): print(header) -if os.environ.get("ENABLE_TAICHI_HEADER_PRINT", True): +if os.getenv("ENABLE_TAICHI_HEADER_PRINT", "True").lower() not in ("false", "0", "f"): _print_taichi_header() @@ -237,7 +241,9 @@ def warn_restricted_version(): ) print() print_yellow_bold(" $ python3 -m pip install --upgrade pip") - print_yellow_bold(" $ python3 -m pip install --force-reinstall taichi") + print_yellow_bold( + " $ python3 -m pip install --force-reinstall taichi" + ) print() print_yellow_bold( From 8c62aa57e84c1e00a6757a35ac570facbf0b5ab1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:14:17 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- python/taichi/_lib/utils.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/python/taichi/_lib/utils.py b/python/taichi/_lib/utils.py index 1eda5a426f4b6..b14dc058a839a 100644 --- a/python/taichi/_lib/utils.py +++ b/python/taichi/_lib/utils.py @@ -82,9 +82,7 @@ def is_ci(): return os.environ.get("TI_CI", "") == "1" -package_root = os.path.join( - os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -) +package_root = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) def get_core_shared_object(): @@ -106,9 +104,7 @@ def print_yellow_bold(*args, **kwargs): def check_exists(src): if not os.path.exists(src): - raise FileNotFoundError( - f'File "{src}" not exist. Installation corrupted or build incomplete?' - ) + raise FileNotFoundError(f'File "{src}" not exist. Installation corrupted or build incomplete?') ti_python_core = import_ti_python_core() @@ -241,9 +237,7 @@ def warn_restricted_version(): ) print() print_yellow_bold(" $ python3 -m pip install --upgrade pip") - print_yellow_bold( - " $ python3 -m pip install --force-reinstall taichi" - ) + print_yellow_bold(" $ python3 -m pip install --force-reinstall taichi") print() print_yellow_bold(