old_contents: import os
  import sys
  from os.path import join
  
  
  if sys.platform != 'cli':
      print "ERROR: This setup script only works under IronPython"
      sys.exit(1)
  
  src_dir = os.getcwd()
  
  
  def msbuild(dir, config):
      # Note: need to use devenv instead of msbuild because msbuild can't build
      # Intel Fortran (.vfproj) files.
      os.chdir(join(src_dir, "scipy", dir))
      cmd = 'devenv %s.sln /Build %s' % (dir, config)
      print cmd
      os.system(cmd)
      print "%s complete"
      os.chdir(src_dir)
  
  def buildall():
      for dir in ["special", "stats", "linalg", "integrate"]:
          if '--release' in sys.argv:
              msbuild(dir, "Release")
          else:
              msbuild(dir, "Debug")
  
  if __name__ == '__main__':
      buildall()
  
new_contents: import os
  import sys
  from os.path import join
  
  
  if sys.platform != 'cli':
      print "ERROR: This setup script only works under IronPython"
      sys.exit(1)
  
  src_dir = os.getcwd()
  
  
  def msbuild(subproject, config):
      # Note: need to use devenv instead of msbuild because msbuild can't build
      # Intel Fortran (.vfproj) files.
      cmd = 'devenv %s.sln /Build %s' % (subproject, config)
      print cmd
      os.system(cmd)
      print "%s complete"
  
  
  def buildall():
      for subproject in ["special", "stats", "linalg", "integrate"]:
          dir_path = join(src_dir, "scipy", subproject)
          os.chdir(dir_path)
          if '--clean' in sys.argv:
              cmd = 'rd /s /q Release Debug'
              print cmd
              os.system(cmd)
  
          if '--release' in sys.argv:
              msbuild(subproject, "Release")
          else:
              msbuild(subproject, "Debug")
  
          os.chdir(src_dir)
  
  
  if __name__ == '__main__':
      buildall()
  
subject: add --cleanup option