Skip to content

Commit

Permalink
adding a cross platform install script!
Browse files Browse the repository at this point in the history
  • Loading branch information
antony-jr committed Dec 29, 2017
1 parent 82996ad commit f2d79f9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Follow the instructions specific for your platform.

**Just execute this command on your project folder and everything will be done for you!**
You must have **curl** to do this , **don't worry** because most of the linux distro's must
have **installed it already** for , if not then the script will **warn** you to install it!
have **installed it already** for you , if not then the script will **warn** you to install it!

```
$ curl -L "https://git.io/vbdTI" | bash
Expand Down
45 changes: 45 additions & 0 deletions install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/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
QArchive = {
"username" : "antony-jr",
"repo" : "QArchive",
"mkdir" : "QArchive",
"install" : {
"QArchive.hpp" : "QArchive/QArchive.hpp",
"LICENSE" : "QArchive/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("Thank you for choosing "+config["repo"])
print("Successfully Installed "+config["repo"] + "!")
return True

if __name__ == "__main__":
installPackage(QArchive)
sys.exit(0)

0 comments on commit f2d79f9

Please sign in to comment.