@@ -127,10 +127,14 @@ def setup_pipenv_in_package(env, penv_dir):
127
127
128
128
# Validate virtual environment creation
129
129
# Ensure Python executable is available
130
- assert os .path .isfile (
131
- get_executable_path (penv_dir , "python" )
132
- ), f"Error: Failed to create a proper virtual environment. Missing the `python` binary! Created with uv: { uv_success } "
133
-
130
+ penv_python = get_executable_path (penv_dir , "python" )
131
+ if not os .path .isfile (penv_python ):
132
+ sys .stderr .write (
133
+ f"Error: Failed to create a proper virtual environment. "
134
+ f"Missing the `python` binary at { penv_python } ! Created with uv: { uv_success } \n "
135
+ )
136
+ sys .exit (1 )
137
+
134
138
return uv_cmd if uv_success else None
135
139
136
140
return None
@@ -530,9 +534,13 @@ def _setup_pipenv_minimal(penv_dir):
530
534
531
535
# Validate virtual environment creation
532
536
# Ensure Python executable is available
533
- assert os .path .isfile (
534
- get_executable_path (penv_dir , "python" )
535
- ), f"Error: Failed to create a proper virtual environment. Missing the `python` binary! Created with uv: { uv_success } "
537
+ penv_python = get_executable_path (penv_dir , "python" )
538
+ if not os .path .isfile (penv_python ):
539
+ sys .stderr .write (
540
+ f"Error: Failed to create a proper virtual environment. "
541
+ f"Missing the `python` binary at { penv_python } ! Created with uv: { uv_success } \n "
542
+ )
543
+ sys .exit (1 )
536
544
537
545
return uv_cmd if uv_success else None
538
546
0 commit comments