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

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

commit 6235ac248a56dc47081b34db3c2b6e97ac6bb8cd
Author: Jarek Potiuk <jarek.pot...@polidea.com>
AuthorDate: Tue May 10 11:49:39 2022 +0200

    Make Breeze help generation indepdent from having breeze installed (#23612)
    
    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
    
    (cherry picked from commit e36868ba1b8a26f838851d1d09cca9db64cbcdc8)
---
 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 16494672c4..c01c6bfbf6 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 @@ from rich.console import Console
 
 AIRFLOW_SOURCES_DIR = Path(__file__).parents[3].resolve()
 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

Reply via email to