(cmd)
| 208 | |
| 209 | |
| 210 | def run_install(cmd): |
| 211 | print() |
| 212 | print("Installing:", printable_shell_command(cmd)) |
| 213 | |
| 214 | # First ensure pip is available |
| 215 | ensurepip_cmd = [sys.executable, "-m", "ensurepip", "--upgrade"] |
| 216 | try: |
| 217 | subprocess.run(ensurepip_cmd, capture_output=True, check=False) |
| 218 | except Exception: |
| 219 | pass # Continue even if ensurepip fails |
| 220 | |
| 221 | try: |
| 222 | output = [] |
| 223 | process = subprocess.Popen( |
| 224 | cmd, |
| 225 | stdout=subprocess.PIPE, |
| 226 | stderr=subprocess.STDOUT, |
| 227 | text=True, |
| 228 | bufsize=1, |
| 229 | universal_newlines=True, |
| 230 | encoding=sys.stdout.encoding, |
| 231 | errors="replace", |
| 232 | ) |
| 233 | spinner = Spinner("Installing...") |
| 234 | |
| 235 | while True: |
| 236 | char = process.stdout.read(1) |
| 237 | if not char: |
| 238 | break |
| 239 | |
| 240 | output.append(char) |
| 241 | spinner.step() |
| 242 | |
| 243 | spinner.end() |
| 244 | return_code = process.wait() |
| 245 | output = "".join(output) |
| 246 | |
| 247 | if return_code == 0: |
| 248 | print("Installation complete.") |
| 249 | print() |
| 250 | return True, output |
| 251 | |
| 252 | except subprocess.CalledProcessError as e: |
| 253 | print(f"\nError running pip install: {e}") |
| 254 | |
| 255 | print("\nInstallation failed.\n") |
| 256 | |
| 257 | return False, output |
| 258 | |
| 259 | |
| 260 | def find_common_root(abs_fnames): |
no test coverage detected