Skip to content

Instantly share code, notes, and snippets.

@whyvez
Created February 14, 2016 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whyvez/973ed0754a424ab44218 to your computer and use it in GitHub Desktop.
Save whyvez/973ed0754a424ab44218 to your computer and use it in GitHub Desktop.
install python package from github
#!/usr/bin/env python
"""installGithub.r
Usage: installGithub.r <repo> [-h] [--ref=<ref>] [--token=<token>]
-h --help show this help text
-r --ref=<ref> Git ref
-t --token=<token> Github token
where REPO is a GitHub repositories.
where GIT_REF... is a Git ref i.e. master, v1.0.
where GITHUB_TOKEN... is a GitHub auth token.
Examples:
installGithub.r RcppCore/RcppEigen -r v1.0 -t eeb9c8a5f416f7cfe982734440e39fa72abbcb33
"""
import pip
from docopt import docopt
if __name__ == '__main__':
args = docopt(__doc__)
token = "@" + args["--token"] if args["--token"] else ""
ref = "@" + args["--ref"] if args["--ref"] else ""
repo_url = "git+https://%sgithub.com/%s.git%s" % (token, args["<repo>"], ref)
pip.main(["install", repo_url, "master")])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment