Commits

aleric committed 1893986

SNOW-766: Add a 'printbuilddirs' command to develop.py

Comments (0)

Files changed (2)

doc/contributions.txt

 	VWR-12691
 	VWR-13996
 	VWR-14426
+	SNOW-766
 Ales Beaumont
 	VWR-9352
 Alissa Sabre
   -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.
 '''
 
 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(
         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')
             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)"