forked from KaiSta/scrates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
29 lines (25 loc) · 1011 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import urllib.request, shutil, zipfile, os.path, os
wxwidget = "http://kaist.bplaced.net/tempest/libs/wxwidget.zip"
cryptopp = "http://kaist.bplaced.net/tempest/libs/cryptopp.zip"
pugixml = "http://kaist.bplaced.net/tempest/libs/pugixml.zip"
def downloadfile(url):
filename = url.split('/')[-1]
print("downloading " + filename + "...")
with urllib.request.urlopen(url) as response, open('lib\\'+filename, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
print("unzip " + filename + "...")
unzip('lib\\' + filename, 'lib\\')
def unzip(source_filename, dest_dir):
with zipfile.ZipFile(source_filename) as zf:
for member in zf.infolist():
words = member.filename.split('/')
path = dest_dir
for word in words[:-1]:
drive, word = os.path.splitdrive(word)
head, word = os.path.split(word)
if word in (os.curdir, os.pardir, ''): continue
path = os.path.join(path, word)
zf.extract(member, path)
downloadfile(pugixml)
downloadfile(wxwidget)
downloadfile(cryptopp)