def main(main_name):
  """The main entry point to the bootstrapper. Call this with the module name to
  use as your main app."""
  # prelaunch should bypass full bootstrap
  if prelaunch_client.is_prelaunch_client(sys.argv):
    # This is a lightweight import due to lazy initialization of the message loop.
    import message_loop
    if message_loop.supports_prelaunch():
      return sys.exit(prelaunch_client.main(sys.argv))

    # Remove the prelaunch command from the argv and proceed as normal.
    prelaunch_client.remove_prelaunch_from_sys_argv()

  if sys.platform == 'darwin':
    if ('--chrome' in sys.argv):
      sys.argv.insert(1, '--main-name')
      sys.argv.insert(2, main_name)
      sys.exit(run())

    if ('--curses' in sys.argv):
      sys.argv.insert(1, '--main-name')
      sys.argv.insert(2, main_name)
      sys.exit(run())

    # Try using chrome.
    import message_loop_chrome
    if message_loop_chrome.supported():
      sys.argv.insert(1, '--main-name')
      sys.argv.insert(2, main_name)
      sys.exit(run())

    # To use wx-widgets on darwin, we need to be in 32 bit mode. Import of wx
    # will fail if you run python in 64 bit mode, which is default in 10.6+. :'(
    # It is depressingly hard to force python into 32 bit mode reliably across
    # computers, for some reason. So, we try two approaches known to work... one
    # after the other.
    wx_found_but_failed = False
    try:
      import wx
    except __HOLE__:
      if str(sys.exc_value).find("no appropriate 64-bit") != -1:
        wx_found_but_failed = True

    if wx_found_but_failed:
      # Switch the executable to /usr/bin/python2.6 if we are implicitly running
      # 2.6 via /usr/bin/python. For some reason, neither the arch trick nor the
      # env trick work if you use /usr/bin/python
      if sys.version.startswith("2.6") and sys.executable == '/usr/bin/python':
        if os.path.exists('/usr/bin/python2.6'):
          executable = '/usr/bin/python2.6'
        else:
          executable = sys.executable
      else:
        executable = sys.executable

      # try using the versioner trick
      if '--triedenv' not in sys.argv:
        os.putenv('VERSIONER_PYTHON_PREFER_32_BIT', 'yes')
        args = [executable, sys.argv[0], '--triedenv']
        args.extend(sys.argv[1:])
        os.execve(args[0], args, os.environ)

      # last chance...
      if '--triedarch' not in sys.argv:
        args = ["/usr/bin/arch", "-i386", executable, sys.argv[0], '--triedarch']
        args.extend(sys.argv[1:])
        os.execv(args[0], args)

      # did we already try one of the tricks below? Bail out to prevent recursion...
      print "Your system's python is 64 bit, and all the tricks we know to get it into 32b mode failed."
      sys.exit(255)

    else:
      try:
        sys.argv.remove('--triedenv')
      except:
        pass
      try:
        sys.argv.remove('--triedarch')
      except:
        pass
      sys.argv.insert(1, '--main-name')
      sys.argv.insert(2, main_name)
      sys.exit(run())

  else:
    sys.argv.insert(1, '--main-name')
    sys.argv.insert(2, main_name)
    sys.exit(run())
dataset/ETHPy150Open natduca/quickopen/src/bootstrap.py/main