kopia lustrzana https://github.com/micropython/micropython-lib
upip: Report package not found and similar errors with less noise.
While still allow to get full backtrace with --debug.pull/158/head
rodzic
f6668aae28
commit
068988085e
13
upip/upip.py
13
upip/upip.py
|
@ -124,13 +124,14 @@ def url_open(url):
|
||||||
l = s.readline()
|
l = s.readline()
|
||||||
protover, status, msg = l.split(None, 2)
|
protover, status, msg = l.split(None, 2)
|
||||||
if status != b"200":
|
if status != b"200":
|
||||||
|
exc = ValueError(status)
|
||||||
if status == b"404":
|
if status == b"404":
|
||||||
print("Package not found")
|
fatal("Package not found", exc)
|
||||||
raise ValueError(status)
|
fatal("Unexpected error querying for package", exc)
|
||||||
while 1:
|
while 1:
|
||||||
l = s.readline()
|
l = s.readline()
|
||||||
if not l:
|
if not l:
|
||||||
raise ValueError("Unexpected EOF")
|
fatal("Unexpected EOF in HTTP headers", ValueError())
|
||||||
if l == b'\r\n':
|
if l == b'\r\n':
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -144,8 +145,10 @@ def get_pkg_metadata(name):
|
||||||
return json.loads(s)
|
return json.loads(s)
|
||||||
|
|
||||||
|
|
||||||
def fatal(msg):
|
def fatal(msg, exc=None):
|
||||||
print(msg)
|
print("Error:", msg)
|
||||||
|
if exc and debug:
|
||||||
|
raise exc
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def install_pkg(pkg_spec, install_path):
|
def install_pkg(pkg_spec, install_path):
|
||||||
|
|
Ładowanie…
Reference in New Issue