From f2d79f95515381b447591b638633abaab1d79f4f Mon Sep 17 00:00:00 2001 From: antony-jr <antonyjr@protonmail.com> Date: Fri, 29 Dec 2017 05:48:44 +0530 Subject: [PATCH] adding a cross platform install script! --- docs/Installation.md | 2 +- install.py | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 install.py diff --git a/docs/Installation.md b/docs/Installation.md index 1ad230b..a13ffeb 100644 --- a/docs/Installation.md +++ b/docs/Installation.md @@ -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 diff --git a/install.py b/install.py new file mode 100755 index 0000000..3322c80 --- /dev/null +++ b/install.py @@ -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)