Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
aac2db9a
Commit
aac2db9a
authored
8 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
tools/upip: Update to 1.1.5. Better and more user-friendly error handling.
parent
e08395a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/upip.py
+14
-6
14 additions, 6 deletions
tools/upip.py
with
14 additions
and
6 deletions
tools/upip.py
+
14
−
6
View file @
aac2db9a
...
...
@@ -105,7 +105,10 @@ warn_ussl = True
def
url_open
(
url
):
global
warn_ussl
proto
,
_
,
host
,
urlpath
=
url
.
split
(
'
/
'
,
3
)
try
:
ai
=
usocket
.
getaddrinfo
(
host
,
443
)
except
OSError
as
e
:
fatal
(
"
Unable to resolve %s (no Internet?)
"
%
host
,
e
)
#print("Address infos:", ai)
addr
=
ai
[
0
][
4
]
...
...
@@ -124,13 +127,16 @@ def url_open(url):
l
=
s
.
readline
()
protover
,
status
,
msg
=
l
.
split
(
None
,
2
)
if
status
!=
b
"
200
"
:
s
.
close
()
exc
=
ValueError
(
status
)
if
status
==
b
"
404
"
:
print
(
"
Package not found
"
)
raise
ValueError
(
status
)
fatal
(
"
Package not found
"
,
exc
)
fatal
(
"
Unexpected error querying for package
"
,
exc
)
while
1
:
l
=
s
.
readline
()
if
not
l
:
raise
ValueError
(
"
Unexpected EOF
"
)
s
.
close
()
fatal
(
"
Unexpected EOF in HTTP headers
"
,
ValueError
())
if
l
==
b
'
\r\n
'
:
break
...
...
@@ -144,8 +150,10 @@ def get_pkg_metadata(name):
return
json
.
loads
(
s
)
def
fatal
(
msg
):
print
(
msg
)
def
fatal
(
msg
,
exc
=
None
):
print
(
"
Error:
"
,
msg
)
if
exc
and
debug
:
raise
exc
sys
.
exit
(
1
)
def
install_pkg
(
pkg_spec
,
install_path
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment