Colin Nolan 2025-06-27 16:49:23 +01:00 zatwierdzone przez GitHub
commit f5d46df8cc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 8 dodań i 3 usunięć

Wyświetl plik

@ -168,6 +168,12 @@ def _install_package(package, index, target, version, mpy):
return _install_json(package, index, target, version, mpy)
class InstallError(RuntimeError):
"""
Raised when an installation fails.
"""
def install(package, index=None, target=None, version=None, mpy=True):
if not target:
for p in sys.path:
@ -175,8 +181,7 @@ def install(package, index=None, target=None, version=None, mpy=True):
target = p
break
else:
print("Unable to find lib dir in sys.path")
return
raise InstallError("Unable to find lib dir in sys.path")
if not index:
index = _PACKAGE_INDEX
@ -184,4 +189,4 @@ def install(package, index=None, target=None, version=None, mpy=True):
if _install_package(package, index.rstrip("/"), target, version, mpy):
print("Done")
else:
print("Package may be partially installed")
raise InstallError("Package may be partially installed")