Last active
January 1, 2016 11:19
-
-
Save Taiiwo/8137600 to your computer and use it in GitHub Desktop.
fpspm stands for Filthy Python Script Package Manager, as it build to allow the simple creation and addition of repositories containing useful python script, and a medium to run these script from anywhere, without messing up /usr/bin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import sys | |
import json | |
# initialize: | |
## mkdir ~./fpspm | |
## touch ~./fpspm/local.repo | |
# This part is for adding things to the local repo. | |
# You can add: | |
## individual scripts | |
## repos (A list of scripts) | |
# open the local repo | |
f = open ('~/.fpspm/local.repo') | |
def add_user_script(script_name,url,local_repo): | |
local_repo['user_submitted'].append(url) | |
def add_repo(url,local_repo): | |
new_repo = urllib2.urlopen(url).read() | |
local_repo[url] = [] | |
for script in new_repo.splitlines(): | |
local_repo[url].append(script) | |
def install(script_name, local_repo): | |
#search for script: | |
for repo in local_repo: | |
for script in repo: | |
if script == | |
if sys.argv[1] == 'add': | |
local_repo = json.loads(f.read()) | |
if sys.argv[2] == 'script': | |
add_user_script(sys.argv[3],sys.argv[4],local_repo) | |
if sys.argv[2] == 'repo': | |
add_repo(sys.argv[3],local_repo) | |
if sys.argv[1] == 'install': | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment