code: def build():
      parser = OptionParser()
      parser.add_option(
          "-p",
          "--python",
          dest="python",
          default=sys.executable,
          help="python interpreter executable",
          metavar="PYTHON_EXE",
      )
      parser.add_option(
          "-r",
          "--readme",
          dest="readme",
          default="README.rst",
          help="README file",
          metavar="README",
      )
      parser.add_option(
          "-s",
          "--sudo",
          dest="sudo",
          default=False,
          help="Run as sudo or no",
          metavar="SUDO",
      )
      (options, args) = parser.parse_args()
      try:
          src_dir = args[0]
      except IndexError:
          src_dir = "."
      # Check source directory
      if not os.path.isfile(os.path.join(src_dir, "setup.py")):
          raise RuntimeError(
              "Run this script from directory "
              "with setup.py, or pass in this "
              "directory on command line"
          )
      # update end-user documentation
      # copy_readme()
      # shellcmd("svn stat %s"%DEV_README)
  
      # change to source directory
      cwd = os.getcwd()
      os.chdir(src_dir)
  
      # build distribution
      remove_dirs(options.sudo)
      build_dist(options.readme, options.python, options.sudo)
      build_dmg(options.sudo)
  
      # change back to original directory
      os.chdir(cwd)
  
file_path: dipy/tools/osxbuild.py
imports: import os
  import sys
  import shutil
  import subprocess
  from optparse import OptionParser
  from getpass import getuser
label_desc: Use image node_id 7 for calling a global function with example usage: build() without return types