check if git installed for openshift

This commit is contained in:
mdipierro
2012-07-05 22:28:54 -05:00
parent b6667e6da8
commit 60cf316e16
2 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.0 (2012-07-05 22:24:31) dev Version 2.00.0 (2012-07-05 22:28:51) dev
+8 -5
View File
@@ -1,9 +1,13 @@
import os import os
from distutils import dir_util from distutils import dir_util
from git import * try:
from git import *
except ImportError:
session.flash = 'requires python-git, but not installed'
redirect(URL('deafult','site'))
def deploy(): def deploy():
apps = sorted(file for file in os.listdir(apath(r=request)))#if regex.match(file)) apps = sorted(file for file in os.listdir(apath(r=request)))
form = SQLFORM.factory( form = SQLFORM.factory(
Field('osrepo',default='/tmp',label='Path to local openshift repo root.', Field('osrepo',default='/tmp',label='Path to local openshift repo root.',
requires=EXISTS(error_message=T('directory not found'))), requires=EXISTS(error_message=T('directory not found'))),
@@ -19,8 +23,7 @@ def deploy():
except: except:
pass pass
ignore_apps = [item for item in apps \ ignore_apps = [item for item in apps if not item in form.vars.applications]
if not item in form.vars.applications]
regex = re.compile('\(applications/\(.*') regex = re.compile('\(applications/\(.*')
w2p_origin = os.getcwd() w2p_origin = os.getcwd()
osrepo = form.vars.osrepo osrepo = form.vars.osrepo
@@ -36,7 +39,7 @@ def deploy():
dir_util.copy_tree(appsrc,appdest) dir_util.copy_tree(appsrc,appdest)
#shutil.copytree(appsrc,appdest) #shutil.copytree(appsrc,appdest)
index.add(['wsgi/'+osname+'/applications/'+i]) index.add(['wsgi/'+osname+'/applications/'+i])
new_commit = index.commit("Deploy from Web2py IDE") #<--- COMMIT WORKED.. Next.. on to actual push. new_commit = index.commit("Deploy from Web2py IDE")
origin = repo.remotes.origin origin = repo.remotes.origin
origin.push origin.push