1
1
#!/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
+
6
9
from __future__ import print_function
10
+
11
+ __author__ = "Ivan Grokhotkov"
12
+ __version__ = "2015"
13
+
7
14
import os
8
15
import shutil
9
16
import errno
15
22
import tarfile
16
23
import zipfile
17
24
import re
25
+
18
26
if sys .version_info [0 ] == 3 :
19
27
from urllib .request import urlretrieve
20
28
unicode = lambda s : str (s )
@@ -55,7 +63,7 @@ def unpack(filename, destination):
55
63
if filename .endswith ('tar.gz' ):
56
64
tfile = tarfile .open (filename , 'r:gz' )
57
65
tfile .extractall (destination )
58
- dirname = tfile .getnames ()[0 ]
66
+ dirname = tfile .getnames ()[0 ]
59
67
elif filename .endswith ('zip' ):
60
68
zfile = zipfile .ZipFile (filename )
61
69
zfile .extractall (destination )
@@ -78,7 +86,7 @@ def get_tool(tool):
78
86
url = tool ['url' ]
79
87
#real_hash = tool['checksum'].split(':')[1]
80
88
if not os .path .isfile (local_path ):
81
- print ('Downloading ' + archive_name );
89
+ print ('Downloading ' + archive_name )
82
90
sys .stdout .flush ()
83
91
if 'CYGWIN_NT' in sys_name :
84
92
import ssl
0 commit comments