mik-laj commented on a change in pull request #19867:
URL: https://github.com/apache/airflow/pull/19867#discussion_r758663294



##########
File path: Breeze2
##########
@@ -0,0 +1,58 @@
+#!/usr/bin/env python3
+# isort: skip
+import os
+import sys
+
+# Python <3.4 does not have pathlib
+if sys.version_info.major != 3 or sys.version_info.minor < 7:
+    print("ERROR! Make sure you use Python 3.7+ !!")
+    sys.exit(1)
+
+import subprocess
+from os import execv
+from pathlib import Path
+
+AIRFLOW_SOURCES_DIR = Path(__file__).parent.resolve()
+BUILD_DIR = AIRFLOW_SOURCES_DIR / ".build"
+BUILD_BREEZE_DIR = BUILD_DIR / "breeze2"
+BUILD_BREEZE_CFG_SAVED = BUILD_BREEZE_DIR / "setup.cfg.saved"
+BUILD_BREEZE_VENV_DIR = BUILD_BREEZE_DIR / "venv"
+BUILD_BREEZE_VENV_BIN_DIR = BUILD_BREEZE_VENV_DIR / "bin"
+BUILD_BREEZE_VENV_PIP = BUILD_BREEZE_VENV_BIN_DIR / "pip"
+BUILD_BREEZE_VENV_BREEZE = BUILD_BREEZE_VENV_BIN_DIR / "Breeze2"
+
+BREEZE_SOURCE_PATH = AIRFLOW_SOURCES_DIR / "dev" / "breeze"
+BREEZE_SETUP_CFG_PATH = BREEZE_SOURCE_PATH / "setup.cfg"
+
+BUILD_BREEZE_DIR.mkdir(parents=True, exist_ok=True)
+
+
+def needs_installation() -> bool:
+    """Returns true if Breeze's virtualenv needs (re)installation"""
+    if not BUILD_BREEZE_VENV_DIR.exists() or not 
BUILD_BREEZE_CFG_SAVED.exists():
+        return True
+    with open(BREEZE_SETUP_CFG_PATH) as current, open(BUILD_BREEZE_CFG_SAVED) 
as saved:
+        current_config, saved_config = current.read(), saved.read()
+    return current_config != saved_config

Review comment:
       ```suggestion
       return BREEZE_SETUP_CFG_PATH.read_text() != 
BUILD_BREEZE_CFG_SAVED.read_text()
   ```
   or
   ```suggestion
       return BREEZE_SETUP_CFG_PATH.read_bytes() != 
BUILD_BREEZE_CFG_SAVED.read_bytes()
   ```
   
   We use pathlib so we can write it a bit easier.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to