From c4acbaf7c4120d4dc6154420c992e3942fd25df3 Mon Sep 17 00:00:00 2001
From: Aleric Inglewood <Aleric.Inglewood@gmail.com>
Date: Fri, 27 Aug 2010 17:32:41 +0200
Subject: [PATCH] SNOW-766: Add a 'printbuilddirs' command to develop.py

---
 doc/contributions.txt |  1 +
 indra/develop.py      | 27 +++++++++++++++------------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index f451c5732e..f4619bff5c 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -64,6 +64,7 @@ Aleric Inglewood
 	VWR-12691
 	VWR-13996
 	VWR-14426
+	SNOW-766
 Ales Beaumont
 	VWR-9352
 Alissa Sabre
diff --git a/indra/develop.py b/indra/develop.py
index 3c88bb8a01..36c947327a 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -742,9 +742,10 @@ Options:
   -p | --project=NAME   set the root project name. (Doesn't effect makefiles)
                         
 Commands:
-  build      configure and build default target
-  clean      delete all build directories, does not affect sources
-  configure  configure project by running cmake (default command if none given)
+  build           configure and build default target
+  clean           delete all build directories, does not affect sources
+  configure       configure project by running cmake (default if none given)
+  printbuilddirs  print the build directory that will be used
 
 Command-options for "configure":
   We use cmake variables to change the build configuration.
@@ -762,15 +763,6 @@ Examples:
 '''
 
 def main(arguments):
-    if os.getenv('DISTCC_DIR') is None:
-        distcc_dir = os.path.join(getcwd(), '.distcc')
-        if not os.path.exists(distcc_dir):
-            os.mkdir(distcc_dir)
-        print "setting DISTCC_DIR to %s" % distcc_dir
-        os.environ['DISTCC_DIR'] = distcc_dir
-    else:
-        print "DISTCC_DIR is set to %s" % os.getenv('DISTCC_DIR')
- 
     setup = setup_platform[sys.platform]()
     try:
         opts, args = getopt.getopt(
@@ -832,6 +824,14 @@ For example: develop.py configure -DSERVER:BOOL=OFF"""
         if cmd in ('cmake', 'configure'):
             setup.run_cmake(args)
         elif cmd == 'build':
+            if os.getenv('DISTCC_DIR') is None:
+                distcc_dir = os.path.join(getcwd(), '.distcc')
+                if not os.path.exists(distcc_dir):
+                    os.mkdir(distcc_dir)
+                print "setting DISTCC_DIR to %s" % distcc_dir
+                os.environ['DISTCC_DIR'] = distcc_dir
+            else:
+                print "DISTCC_DIR is set to %s" % os.getenv('DISTCC_DIR')
             for d in setup.build_dirs():
                 if not os.path.exists(d):
                     raise CommandError('run "develop.py cmake" first')
@@ -842,6 +842,9 @@ For example: develop.py configure -DSERVER:BOOL=OFF"""
             if args:
                 raise CommandError('clean takes no arguments')
             setup.cleanup()
+        elif cmd == 'printbuilddirs':
+            for d in setup.build_dirs():
+                print >> sys.stdout, d
         else:
             print >> sys.stderr, 'Error: unknown subcommand', repr(cmd)
             print >> sys.stderr, "(run 'develop.py --help' for help)"
-- 
GitLab