Mercurial > hg > MakeItSo
changeset 133:cd51ef9288ea
WIP
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 03 Nov 2011 11:00:01 -0700 |
parents | 06e6eac2fd4d |
children | 0e18cdf36a0e |
files | makeitso/python_package/INSTALL.py makeitso/python_package/INSTALL.sh |
diffstat | 2 files changed, 52 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makeitso/python_package/INSTALL.py Thu Nov 03 11:00:01 2011 -0700 @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +""" +installation script for {{project}} +{{description}} +""" + +import os +import sys +import urllib2 +import subprocess +try: + from subprocess import check_call as call +except: + from subprocess import call + +REPO='{{repo}}' +DEST='{{project}}' # name of the virtualenv +VIRTUALENV='https://raw.github.com/pypa/virtualenv/develop/virtualenv.py' + +def which(binary, path=os.environ['PATH']): + dirs = path.split(os.pathsep) + for dir in dirs: + if os.path.isfile(os.path.join(dir, fileName)): + return os.path.join(dir, fileName) + if os.path.isfile(os.path.join(dir, fileName + ".exe")): + return os.path.join(dir, fileName + ".exe") + +def main(args=sys.argv[1:]): + + # create a virtualenv + virtualenv = which('virtualenv') or which('virtualenv.py') + if virtualenv: + call([virtualenv, DEST]) + else: + process = subproces.Popen([sys.executable, '-', DEST], stdin=subprocess.PIPE) + process.communicate(stdin=urllib2.urlopen(VIRTUALENV).read()) + + # create a src directory + src = os.path.join(DEST, 'src') + os.mkdir(src) + + # clone the repository + call(['hg', 'clone', REPO], cwd=src) + +""" +XXX unfinished + +hg clone ${REPO} +cd {{project}} +python setup.py develop +"""
--- a/makeitso/python_package/INSTALL.sh Sat Sep 17 10:29:10 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -#!/usr/bin/bash - -# installation script for {{project}} -# {{description}} - -REPO='{{repo}}' -DEST='{{project}}' # name of the virtualenv - -if [ "$#" != "0" ] -then - DEST=$1 -fi - -if which virtualenv -then - virtualenv ${DEST} -else - curl https://bitbucket.org/ianb/virtualenv/raw/tip/virtualenv.py | python - ${DEST} -fi -cd ${DEST} -. bin/activate # linux only -mkdir src -cd src -hg clone ${REPO} -cd {{project}} -python setup.py develop