Fix coding stype as per PEP8 (#1105)
This commit is contained in:
parent
7aa7c3f0dd
commit
e2f7736cf0
20
tools/get.py
Normal file → Executable file
20
tools/get.py
Normal file → Executable file
@ -1,9 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# This script will download and extract required tools into the current directory.
|
|
||||||
# Tools list is obtained from package/package_esp8266com_index.template.json file.
|
"""Script to download and extract tools
|
||||||
# Written by Ivan Grokhotkov, 2015.
|
|
||||||
#
|
This script will download and extract required tools into the current directory.
|
||||||
|
Tools list is obtained from package/package_esp8266com_index.template.json file.
|
||||||
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
__author__ = "Ivan Grokhotkov"
|
||||||
|
__version__ = "2015"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import errno
|
import errno
|
||||||
@ -15,6 +22,7 @@ import sys
|
|||||||
import tarfile
|
import tarfile
|
||||||
import zipfile
|
import zipfile
|
||||||
import re
|
import re
|
||||||
|
|
||||||
if sys.version_info[0] == 3:
|
if sys.version_info[0] == 3:
|
||||||
from urllib.request import urlretrieve
|
from urllib.request import urlretrieve
|
||||||
unicode = lambda s: str(s)
|
unicode = lambda s: str(s)
|
||||||
@ -55,7 +63,7 @@ def unpack(filename, destination):
|
|||||||
if filename.endswith('tar.gz'):
|
if filename.endswith('tar.gz'):
|
||||||
tfile = tarfile.open(filename, 'r:gz')
|
tfile = tarfile.open(filename, 'r:gz')
|
||||||
tfile.extractall(destination)
|
tfile.extractall(destination)
|
||||||
dirname= tfile.getnames()[0]
|
dirname = tfile.getnames()[0]
|
||||||
elif filename.endswith('zip'):
|
elif filename.endswith('zip'):
|
||||||
zfile = zipfile.ZipFile(filename)
|
zfile = zipfile.ZipFile(filename)
|
||||||
zfile.extractall(destination)
|
zfile.extractall(destination)
|
||||||
@ -78,7 +86,7 @@ def get_tool(tool):
|
|||||||
url = tool['url']
|
url = tool['url']
|
||||||
#real_hash = tool['checksum'].split(':')[1]
|
#real_hash = tool['checksum'].split(':')[1]
|
||||||
if not os.path.isfile(local_path):
|
if not os.path.isfile(local_path):
|
||||||
print('Downloading ' + archive_name);
|
print('Downloading ' + archive_name)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if 'CYGWIN_NT' in sys_name:
|
if 'CYGWIN_NT' in sys_name:
|
||||||
import ssl
|
import ssl
|
||||||
|
Loading…
Reference in New Issue
Block a user