Description: Multiplexer for invoking multiple setup.py in subdir
Author: Stefano Zacchiroli <zack@debian.org>
Forwarded: not-needed
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,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)
