-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.py
executable file
·67 lines (59 loc) · 1.93 KB
/
install.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
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/python
#
# BSD-3 Clause.
# Copyright (C) 2017 Antony Jr.
#
# Simple Cross Platform Installer Script
import sys
import os
import requests
from shutil import rmtree
# Packages to install
QInstallerBridge = {
"username" : "antony-jr",
"repo" : "QInstallerBridge",
"mkdir" : "QInstallerBridge",
"install" : {
"QInstallerBridge.hpp" : "QInstallerBridge/QInstallerBridge.hpp",
"LICENSE" : "QInstallerBridge/LICENSE"
}
}
QArchive = {
"username" : "antony-jr",
"repo" : "QArchive",
"mkdir" : "QInstallerBridge/QArchive",
"install" : {
"QArchive.hpp" : "QInstallerBridge/QArchive/QArchive.hpp",
"LICENSE" : "QInstallerBridge/QArchive/LICENSE"
}
}
QEasyDownloader = {
"username" : "antony-jr",
"repo" : "QEasyDownloader",
"mkdir" : "QInstallerBridge/QEasyDownloader",
"install" : {
"QEasyDownloader.hpp" : "QInstallerBridge/QEasyDownloader/QEasyDownloader.hpp",
"LICENSE" : "QInstallerBridge/QEasyDownloader/LICENSE"
}
}
def installPackage(config):
print("Installing " + config["repo"])
print("Creating Directory " + config["mkdir"])
if os.path.exists(config["mkdir"]):
rmtree(config["mkdir"])
os.mkdir(config["mkdir"]) # Make the directory!
print("Downloading the latest release from github... ")
# Write files from the repo
for i in config["install"]:
resp = requests.get("https://raw.githubusercontent.com/"+config["username"]+"/"+config["repo"]+"/master/" + i)
fp = open(config["install"][i] , "wb")
for it in resp:
fp.write(it)
fp.close()
print("Installed "+config["repo"] + ".")
return True
if __name__ == "__main__":
installPackage(QInstallerBridge)
installPackage(QArchive)
installPackage(QEasyDownloader)
sys.exit(0)