-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathsetup.py
55 lines (40 loc) · 2.37 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python3
import urllib.request
import tarfile
import platform
import os
import shutil
from multiprocessing import Pool
def dlAndExtract(tup):
url = tup[0]
filename = tup[1]
extractto = tup[2]
print("downloading " + filename)
if not os.path.isfile(filename):
# download
with urllib.request.urlopen(url) as response, open(filename, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
print("extracting " + filename + " to " + extractto)
# extract
tar = tarfile.open(filename)
tar.extractall(extractto)
chigraphDir = os.path.dirname(os.path.realpath(__file__))
thirdPartyDir = os.path.join(chigraphDir, "third_party")
urls=[]
print("Downloading dependencies for system: {}".format(platform.system()))
if platform.system() == "Linux":
urls.append(('https://github.com/chigraph/chigraph/releases/download/dependencies/kf5-5.32.0-debug-gcc-linux64.tar.xz', os.path.join(thirdPartyDir, "kf5-debug.tar.xz"), thirdPartyDir))
urls.append(('https://github.com/chigraph/chigraph/releases/download/dependencies/kf5-5.32.0-release-gcc-linux64.tar.xz', os.path.join(thirdPartyDir, "kf5-release.tar.xz"), thirdPartyDir))
elif platform.system() == "Windows":
urls.append(('https://github.com/chigraph/chigraph/releases/download/dependencies/flexbison-win32.tar.xz', os.path.join(thirdPartyDir, "flexbison-win32.tar.xz"), thirdPartyDir))
urls.append(('https://github.com/chigraph/chigraph/releases/download/dependencies/gettext-win64.tar.xz', os.path.join(thirdPartyDir, "gettext-win64.tar.xz"), thirdPartyDir))
urls.append(('https://github.com/chigraph/chigraph/releases/download/dependencies/iconv-win64.tar.xz', os.path.join(thirdPartyDir, "iconv-win64.tar.xz"), thirdPartyDir))
urls.append(('https://github.com/chigraph/chigraph/releases/download/dependencies/zlib-win64.tar.xz', os.path.join(thirdPartyDir, "zlib-win64.tar.xz"), thirdPartyDir))
urls.append(('https://github.com/chigraph/chigraph/releases/download/dependencies/kf5-5.30.0-debug-msvc14-win64.tar.xz', os.path.join(thirdPartyDir, "kf5-debug.tar.xz"), thirdPartyDir))
urls.append(('https://github.com/chigraph/chigraph/releases/download/dependencies/kf5-5.30.0-release-msvc14-win64.tar.xz', os.path.join(thirdPartyDir, "kf5-release.tar.xz"), thirdPartyDir))
elif platform.system() == "Darwin":
pass
else:
print("Unrecognized system: {}".format(platform.system()))
for url in urls:
dlAndExtract(url)