[RELEASE] module.ghub

Hi This module is a small but a very powerfull one. It loads a github repository to your sys.path in runtime, and updates it whenever there is a new release.
Hope you find it usefull. I generally use it to load latest version of youtube-dl.

You can view the code from, https://github.com/hbiyik/script.module.ghub or download the zipball https://raw.githubusercontent.com/hbiyik…-0.0.1.zip ,

Your comments are wellcome.

def load(uname, rname, branch, commit=None, path=[], period=24)

Loads, caches, and arranges paths for a repo from github. github repo is downlaoded and extracted to userdata/addon_data/scirpt.module.gub/uname/package/branch/commit It also updates the package automatically in a given period (24h default) Note that this is not a package manager and does not do any dependency check

Example:

PHP Code:
import ghub

ghub.load("hbiyik""script.module.boogie""master"None, ["lib"])

#now you can safely import this module
import boogie 

Quote:Params:

uname github username
rname repository name
branch github branch (ie master), if this parameter is None, latest tagged version is used.
commit [optional,None] commit of the specified branch, if None is specified latest commit is fetched, if brach is None, this parameter is dismissed
path [optional,[]] list of directories pointing to the root directory of source ie, if source is in lib/src folder path should be [“lib”, “src”]
Returns: None

Below is an example how to import youtube-dl in runtime with the latest commit from master, and updated in each 24 hours whenever there is a new commit

PHP Code:
import ghub
import sys
import datetime
import time

# fix for sys.stderr.isatty() is not implemented in kodi python interpreter
def proxyisatty():
    return 
False

#fix for datatetime.strptime returns None
class proxydt(datetime.datetime):
    
def __init__(self, *args, **kwargs):
        
super(proxydtself).__init__(*args, **kwargs)

    @staticmethod
    def strptime
(date_stringformat):
        return 
datetime.datetime(*(time.strptime(date_stringformat)[0:6]))

sys.stderr.isatty proxyisatty
datetime
.datetime proxydt
ghub
.load("rg3""youtube-dl""master")
#thats it now, you have youtube-dl with the latest commit from master :)
import youtube_dl