You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/15 12:17:04 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #19992: Enable local Breeze script and pipx to be used for breeze bootstrap

potiuk commented on a change in pull request #19992:
URL: https://github.com/apache/airflow/pull/19992#discussion_r769571893



##########
File path: Breeze2
##########
@@ -41,15 +49,35 @@ def save_config():
 
 if needs_installation():
     print(f"(Re)Installing Breeze's virtualenv in {BUILD_BREEZE_VENV_DIR}")
-    BUILD_BREEZE_VENV_DIR.mkdir(parents=True, exist_ok=True)
-    subprocess.run([sys.executable, "-m", "venv", f"{BUILD_BREEZE_VENV_DIR}"], check=True)
-    subprocess.run(
-        [f"{BUILD_BREEZE_VENV_PIP}", "install", "--upgrade", "-e", "."], cwd=BREEZE_SOURCE_PATH, check=True
-    )
+    try:
+        EnvBuilder(system_site_packages=False, upgrade=True, with_pip=True, prompt="breeze").create(
+            str(BUILD_BREEZE_VENV_DIR)
+        )
+    except Exception as e:
+        # in some cases (mis-configured python) the venv creation might not work via API
+        # (ensurepip missing). This is the case in case of default MacOS Python and Python executable
+        # Bundled in Windows executable, In this case we fallback to running venv as a tool using default
+        # Python3 found on path (in case of Windows Bundled exe, you don't even have a current
+        # interpreted executable available, because Python interpreter is executed through a library.
+        # and sys.executable points to the Bundled exe file.
+        BUILD_BREEZE_VENV_DIR.mkdir(parents=True, exist_ok=True)
+        subprocess.run(["python3", "-m", "venv", f"{BUILD_BREEZE_VENV_DIR}"], check=True, shell=True)

Review comment:
       Is there a better option @uranusjr ?




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org