1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/usr/bin/python
# Multiplexer for invoking multiple setup.py in subdir
# Copyright (C) 2009 Stefano Zacchiroli <zack@debian.org>
# License: GNU GPL version 3 or above
# Created: Sat, 30 May 2009 14:47:04 +0200
# Last-Modified: Sat, 30 May 2009 14:47:04 +0200
import os, string, sys
if not os.environ.has_key('SUBDIRS') or not os.environ['SUBDIRS']:
print >> sys.stderr, "Can't find subdirs, please set SUBDIRS envvar"
sys.exit(3)
else:
subdirs = os.environ['SUBDIRS'].split()
setup_cmd = "python setup.py %s" % string.join(sys.argv[1:])
topdir = os.getcwd()
for d in subdirs:
if not os.path.isdir(d):
print >> sys.stderr, "WARNING: can't find subdir %s" % d
continue
os.chdir(d)
retcode = os.system(setup_cmd)
if retcode:
print >> sys.stderr, "ERROR: setup.py in subdir %s failed" % d
sys.exit(retcode >> 8)
os.chdir(topdir)
|