parameters: ()
docstring: Main program.
docstring_summary: Main program.
docstring_tokens: Main program .
function: def main():
      """Main program."""
  
      # Listen for SIGUSR1 and dump stack if received.
      try:
          signal.signal(signal.SIGUSR1, dump_stacks)
      except AttributeError:
          print("Cannot catch signals on Windows")
  
      parser = optparse.OptionParser(usage="""
  Downloads and installs particular mongodb versions (each binary is renamed
  to include its version) into an install directory and symlinks the binaries
  with versions to another directory. This script supports community and
  enterprise builds.
  
  Usage: setup_multiversion_mongodb.py [options] ver1 [vers2 ...]
  
  Ex: setup_multiversion_mongodb.py --installDir ./install
                                    --linkDir ./link
                                    --edition base
                                    --platformArchitecture Linux/x86_64 2.0.6 2.0.3-rc0
                                    2.0 2.2 2.3
  Ex: setup_multiversion_mongodb.py --installDir ./install
                                    --linkDir ./link
                                    --edition enterprise
                                    --platformArchitecture osx
                                    2.4 2.2
  
  After running the script you will have a directory structure like this:
      ./install/[mongodb-osx-x86_64-2.4.9, mongodb-osx-x86_64-2.2.7]
      ./link/[mongod-2.4.9, mongod-2.2.7, mongo-2.4.9...]
  
  You should then add ./link/ to your path so multi-version tests will work.
  
  Note: If "rc" is included in the version name, we'll use the exact rc, otherwise
  we'll pull the highest non-rc version compatible with the version specified.
  """)
  
      parser.add_option("-i", "--installDir",
                        dest="install_dir",
                        help="Directory to install the download archive. [REQUIRED]",
                        default=None)
      parser.add_option("-l", "--linkDir",
                        dest="link_dir",
                        help="Directory to contain links to all binaries for each version in"
                             " the install directory. [REQUIRED]",
                        default=None)
      editions = ["base", "enterprise", "targeted"]
      parser.add_option("-e", "--edition",
                        dest="edition",
                        choices=editions,
                        help="Edition of the build to download, choose from {}, [default:"
                             " '%default'].".format(editions),
                        default="base")
      parser.add_option("-p", "--platformArchitecture",
                        dest="platform_arch",
                        help="Platform/architecture to download. The architecture is not required."
                             "  [REQUIRED]. Examples include: 'linux/x86_64', 'osx', 'rhel62',"
                             " 'windows/x86_64-2008plus-ssl'.",
                        default=None)
      parser.add_option("-u", "--useLatest",
                        dest="use_latest",
                        action="store_true",
                        help="If specified, the latest (nightly) version will be downloaded,"
                             " if it exists, for the version specified. For example, if specifying"
                             " version 3.2 for download, the nightly version for 3.2 will be"
                             " downloaded if it exists, otherwise the 'highest' version will be"
                             " downloaded, i.e., '3.2.17'",
                        default=False)
  
      options, versions = parser.parse_args()
  
      # Check for required options.
      if (not versions or
          not options.install_dir or
          not options.link_dir or
          not options.platform_arch):
          parser.print_help()
          parser.exit(1)
  
      downloader = MultiVersionDownloader(
          options.install_dir,
          options.link_dir,
          options.edition,
          options.platform_arch,
          options.use_latest)
  
      for version in versions:
          downloader.download_version(version)
function_tokens: def main ( ) : # Listen for SIGUSR1 and dump stack if received. try : signal . signal ( signal . SIGUSR1 , dump_stacks ) except AttributeError : print ( "Cannot catch signals on Windows" ) parser = optparse . OptionParser ( usage = """
  Downloads and installs particular mongodb versions (each binary is renamed
  to include its version) into an install directory and symlinks the binaries
  with versions to another directory. This script supports community and
  enterprise builds.
  
  Usage: setup_multiversion_mongodb.py [options] ver1 [vers2 ...]
  
  Ex: setup_multiversion_mongodb.py --installDir ./install
                                    --linkDir ./link
                                    --edition base
                                    --platformArchitecture Linux/x86_64 2.0.6 2.0.3-rc0
                                    2.0 2.2 2.3
  Ex: setup_multiversion_mongodb.py --installDir ./install
                                    --linkDir ./link
                                    --edition enterprise
                                    --platformArchitecture osx
                                    2.4 2.2
  
  After running the script you will have a directory structure like this:
      ./install/[mongodb-osx-x86_64-2.4.9, mongodb-osx-x86_64-2.2.7]
      ./link/[mongod-2.4.9, mongod-2.2.7, mongo-2.4.9...]
  
  You should then add ./link/ to your path so multi-version tests will work.
  
  Note: If "rc" is included in the version name, we'll use the exact rc, otherwise
  we'll pull the highest non-rc version compatible with the version specified.
  """ ) parser . add_option ( "-i" , "--installDir" , dest = "install_dir" , help = "Directory to install the download archive. [REQUIRED]" , default = None ) parser . add_option ( "-l" , "--linkDir" , dest = "link_dir" , help = "Directory to contain links to all binaries for each version in" " the install directory. [REQUIRED]" , default = None ) editions = [ "base" , "enterprise" , "targeted" ] parser . add_option ( "-e" , "--edition" , dest = "edition" , choices = editions , help = "Edition of the build to download, choose from {}, [default:" " '%default']." . format ( editions ) , default = "base" ) parser . add_option ( "-p" , "--platformArchitecture" , dest = "platform_arch" , help = "Platform/architecture to download. The architecture is not required." "  [REQUIRED]. Examples include: 'linux/x86_64', 'osx', 'rhel62'," " 'windows/x86_64-2008plus-ssl'." , default = None ) parser . add_option ( "-u" , "--useLatest" , dest = "use_latest" , action = "store_true" , help = "If specified, the latest (nightly) version will be downloaded," " if it exists, for the version specified. For example, if specifying" " version 3.2 for download, the nightly version for 3.2 will be" " downloaded if it exists, otherwise the 'highest' version will be" " downloaded, i.e., '3.2.17'" , default = False ) options , versions = parser . parse_args ( ) # Check for required options. if ( not versions or not options . install_dir or not options . link_dir or not options . platform_arch ) : parser . print_help ( ) parser . exit ( 1 ) downloader = MultiVersionDownloader ( options . install_dir , options . link_dir , options . edition , options . platform_arch , options . use_latest ) for version in versions : downloader . download_version ( version )