Funktioniert ansich ganz gut...
Habe mir mal ein kleines Script zusammengehackt, welches meinen 'libary' Ordner (alles Sachen aus verschiedenen SVN Repos) aktualisiert und wenn die 'lib' ne `setup.py` hat, wird die auch ausgeführt.
Das ganze schaut jetzt einfach mal so aus:
Code: Alles auswählen
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os, subprocess, sys
m_pth = sys.path[0]
def read_dir(path):
dirs = [dir for dir in os.listdir(path)
if not dir.startswith('.')]
return dirs
def update_dir(dirname):
print '---------- Update %s ----------' % dirname
pr = subprocess.Popen(('svn update %s' % dirname), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print pr.communicate()[0]
if os.path.exists(os.path.join(dirname, 'setup.py')):
print 'installiere...'
os.chdir(dirname)
pr = subprocess.Popen(('sudo python setup.py install'),
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print pr.communicate()[0]
os.chdir(m_pth)
def main():
dirs = read_dir(os.path.curdir)
print dirs
for dir in dirs:
update_dir(dir)
if __name__ == '__main__':
main()
Geht auch eine 'Live'-Ausgabe? Und wenn ja, wie?
MfG EnTeQuAk