| 380 | |
| 381 | |
| 382 | def uninstall_cefpython3_packages(pythons): |
| 383 | for python in pythons: |
| 384 | print("[build_distrib.py] Uninstall cefpython3 package" |
| 385 | " for: {name}".format(name=python["name"])) |
| 386 | |
| 387 | # Check if package is installed |
| 388 | command = ("\"{python}\" -m pip show cefpython3" |
| 389 | .format(python=python["executable"])) |
| 390 | try: |
| 391 | output = subprocess.check_output(command, shell=True) |
| 392 | except subprocess.CalledProcessError as exc: |
| 393 | # pip show returns error code when package is not installed |
| 394 | output = exc.output |
| 395 | if not len(output.strip()): |
| 396 | # Package is not installed - info is an empty string |
| 397 | print("[build_distrib.py] Not installed") |
| 398 | continue |
| 399 | |
| 400 | # Uninstall package. Only uninstall if package is installed, |
| 401 | # otherwise error code is returned. |
| 402 | command = ("\"{python}\" -m pip uninstall -y cefpython3" |
| 403 | .format(python=python["executable"])) |
| 404 | command = sudo_command(command, python=python["executable"]) |
| 405 | pcode = subprocess.call(command, shell=True) |
| 406 | if pcode != 0: |
| 407 | print("[build_distrib.py] ERROR while uninstall cefpython3" |
| 408 | " package using pip") |
| 409 | sys.exit(1) |
| 410 | |
| 411 | |
| 412 | def run_automate_prebuilt_cef(python): |