11#!/usr/bin/env python
2- # This script will download and extract required tools into the current directory.
3- # Tools list is obtained from package/package_esp8266com_index.template.json file.
4- # Written by Ivan Grokhotkov, 2015.
5- #
2+
3+ """Script to download and extract tools
4+
5+ This script will download and extract required tools into the current directory.
6+ Tools list is obtained from package/package_esp8266com_index.template.json file.
7+ """
8+
69from __future__ import print_function
10+
11+ __author__ = "Ivan Grokhotkov"
12+ __version__ = "2015"
13+
714import os
815import shutil
916import errno
1522import tarfile
1623import zipfile
1724import re
25+
1826if sys .version_info [0 ] == 3 :
1927 from urllib .request import urlretrieve
2028 unicode = lambda s : str (s )
@@ -55,7 +63,7 @@ def unpack(filename, destination):
5563 if filename .endswith ('tar.gz' ):
5664 tfile = tarfile .open (filename , 'r:gz' )
5765 tfile .extractall (destination )
58- dirname = tfile .getnames ()[0 ]
66+ dirname = tfile .getnames ()[0 ]
5967 elif filename .endswith ('zip' ):
6068 zfile = zipfile .ZipFile (filename )
6169 zfile .extractall (destination )
@@ -78,7 +86,7 @@ def get_tool(tool):
7886 url = tool ['url' ]
7987 #real_hash = tool['checksum'].split(':')[1]
8088 if not os .path .isfile (local_path ):
81- print ('Downloading ' + archive_name );
89+ print ('Downloading ' + archive_name )
8290 sys .stdout .flush ()
8391 if 'CYGWIN_NT' in sys_name :
8492 import ssl
0 commit comments