From 0be8f453a59348522f9e41261681f9e773858e59 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Tue, 10 May 2022 08:53:55 +0200 Subject: [PATCH] Make Breeze help generation indepdent from having breeze installed Generation of Breeze help requires breeze to be installed. However if you have locally installed breeze with different dependencies and did not run self-upgrade, the results of generation of the images might be different (for example when different rich version is used). This change works in the way that: * you do not have to have breeze installed at all to make it work * it always upgrades to latest breeze when it is not installed * but this only happens when you actually modified some breeze code --- scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py b/scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py index 74648f2608301..abda3fd834fa7 100755 --- a/scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py +++ b/scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py @@ -25,7 +25,8 @@ AIRFLOW_SOURCES_DIR = Path(__file__).parents[3].absolute() BREEZE_IMAGES_DIR = AIRFLOW_SOURCES_DIR / "images" / "breeze" -BREEZE_SOURCES_DIR = AIRFLOW_SOURCES_DIR / "dev" / "breeze" / "src" +BREEZE_INSTALL_DIR = AIRFLOW_SOURCES_DIR / "dev" / "breeze" +BREEZE_SOURCES_DIR = BREEZE_INSTALL_DIR / "src" SCREENSHOT_WIDTH = "120" @@ -66,11 +67,7 @@ def print_help_for_all_commands(): if old_hash == new_hash: console.print(f"[bright_blue]Skip generation of SVG images as command hash is unchanged {old_hash}") return - if run(["breeze", "--help"], check=False).returncode != 0: - console.print("[red]ERROR! You need to install breeze with pipx to run this pre-commit[/]") - console.print("\n[bright_blue]Run this command:[/]\n") - console.print(" pip install -e ./dev/breeze --force\n") - sys.exit(1) + run([sys.executable, "-m", "pip", "install", "--upgrade", "-e", BREEZE_INSTALL_DIR]) env = os.environ.copy() env['AIRFLOW_SOURCES_ROOT'] = str(AIRFLOW_SOURCES_DIR) env['RECORD_BREEZE_WIDTH'] = SCREENSHOT_WIDTH