Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
731fd19b
Commit
731fd19b
authored
Sep 24, 2019
by
me-no-dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update get.py
Enable insecure download for CI
parent
298c6104
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
tools/get.py
tools/get.py
+27
-1
No files found.
tools/get.py
View file @
731fd19b
...
@@ -25,10 +25,12 @@ import re
...
@@ -25,10 +25,12 @@ import re
if
sys
.
version_info
[
0
]
==
3
:
if
sys
.
version_info
[
0
]
==
3
:
from
urllib.request
import
urlretrieve
from
urllib.request
import
urlretrieve
from
urllib.request
import
urlopen
unicode
=
lambda
s
:
str
(
s
)
unicode
=
lambda
s
:
str
(
s
)
else
:
else
:
# Not Python 3 - today, it is most likely to be Python 2
# Not Python 3 - today, it is most likely to be Python 2
from
urllib
import
urlretrieve
from
urllib
import
urlretrieve
from
urllib
import
urlopen
if
'Windows'
in
platform
.
system
():
if
'Windows'
in
platform
.
system
():
import
requests
import
requests
...
@@ -79,6 +81,26 @@ def unpack(filename, destination):
...
@@ -79,6 +81,26 @@ def unpack(filename, destination):
shutil
.
rmtree
(
rename_to
)
shutil
.
rmtree
(
rename_to
)
shutil
.
move
(
dirname
,
rename_to
)
shutil
.
move
(
dirname
,
rename_to
)
def
download_file
(
url
,
filename
):
import
ssl
import
contextlib
ctx
=
ssl
.
create_default_context
()
ctx
.
check_hostname
=
False
ctx
.
verify_mode
=
ssl
.
CERT_NONE
with
contextlib
.
closing
(
urlopen
(
url
,
context
=
ctx
))
as
fp
:
block_size
=
1024
*
8
block
=
fp
.
read
(
block_size
)
if
block
:
with
open
(
filename
,
'wb'
)
as
out_file
:
out_file
.
write
(
block
)
while
True
:
block
=
fp
.
read
(
block_size
)
if
not
block
:
break
out_file
.
write
(
block
)
else
:
raise
Exception
(
'nonexisting file or connection error'
)
def
get_tool
(
tool
):
def
get_tool
(
tool
):
sys_name
=
platform
.
system
()
sys_name
=
platform
.
system
()
archive_name
=
tool
[
'archiveFileName'
]
archive_name
=
tool
[
'archiveFileName'
]
...
@@ -99,6 +121,10 @@ def get_tool(tool):
...
@@ -99,6 +121,10 @@ def get_tool(tool):
f
=
open
(
local_path
,
'wb'
)
f
=
open
(
local_path
,
'wb'
)
f
.
write
(
r
.
content
)
f
.
write
(
r
.
content
)
f
.
close
()
f
.
close
()
else
:
is_ci
=
os
.
environ
.
get
(
'TRAVIS_BUILD_DIR'
);
if
is_ci
:
download_file
(
url
,
local_path
)
else
:
else
:
urlretrieve
(
url
,
local_path
,
report_progress
)
urlretrieve
(
url
,
local_path
,
report_progress
)
sys
.
stdout
.
write
(
"
\r
Done
\n
"
)
sys
.
stdout
.
write
(
"
\r
Done
\n
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment