parameters: ()
return_statement: return options
docstring: Returns an options object containing the configuration for this script.
docstring_summary: Returns an options object containing the configuration for this script.
docstring_tokens: Returns an options object containing the configuration for this script .
function: def process_options():
    """Returns an options object containing the configuration for this script."""
    parser = optparse.OptionParser()
    parser.add_option(
        '-s', '--landmine-scripts', action='append',
        help='Path to the script which emits landmines to stdout. The target '
             'is passed to this script via option -t. Note that an extra '
             'script can be specified via an env var EXTRA_LANDMINES_SCRIPT.')
    parser.add_option('-d', '--src-dir',
        help='Path of the source root dir. Overrides the default location of the '
             'source root dir when calculating the build directory.')
    parser.add_option(
        '-l',
        '--landmines-path',
        help='Path to the landmines file to use (defaults to .landmines)')
    parser.add_option('-v', '--verbose', action='store_true',
        default=('LANDMINES_VERBOSE' in os.environ),
        help=('Emit some extra debugging information (default off). This option '
            'is also enabled by the presence of a LANDMINES_VERBOSE environment '
            'variable.'))
  
    options, args = parser.parse_args()
  
    if args:
      parser.error('Unknown arguments %s' % args)
  
    logging.basicConfig(
        level=logging.DEBUG if options.verbose else logging.ERROR)
  
    if options.src_dir:
      if not os.path.isdir(options.src_dir):
        parser.error('Cannot find source root dir at %s' % options.src_dir)
      logging.debug('Overriding source root dir. Using: %s', options.src_dir)
    else:
      options.src_dir = \
          os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
  
    if not options.landmine_scripts:
      options.landmine_scripts = [os.path.join(options.src_dir, 'build',
                                               'get_landmines.py')]
  
    extra_script = os.environ.get('EXTRA_LANDMINES_SCRIPT')
    if extra_script:
      options.landmine_scripts += [extra_script]
  
    return options
function_tokens: def process_options ( ) : parser = optparse . OptionParser ( ) parser . add_option ( '-s' , '--landmine-scripts' , action = 'append' , help = 'Path to the script which emits landmines to stdout. The target ' 'is passed to this script via option -t. Note that an extra ' 'script can be specified via an env var EXTRA_LANDMINES_SCRIPT.' ) parser . add_option ( '-d' , '--src-dir' , help = 'Path of the source root dir. Overrides the default location of the ' 'source root dir when calculating the build directory.' ) parser . add_option ( '-l' , '--landmines-path' , help = 'Path to the landmines file to use (defaults to .landmines)' ) parser . add_option ( '-v' , '--verbose' , action = 'store_true' , default = ( 'LANDMINES_VERBOSE' in os . environ ) , help = ( 'Emit some extra debugging information (default off). This option ' 'is also enabled by the presence of a LANDMINES_VERBOSE environment ' 'variable.' ) ) options , args = parser . parse_args ( ) if args : parser . error ( 'Unknown arguments %s' % args ) logging . basicConfig ( level = logging . DEBUG if options . verbose else logging . ERROR ) if options . src_dir : if not os . path . isdir ( options . src_dir ) : parser . error ( 'Cannot find source root dir at %s' % options . src_dir ) logging . debug ( 'Overriding source root dir. Using: %s' , options . src_dir ) else : options . src_dir = os . path . dirname ( os . path . dirname ( os . path . realpath ( __file__ ) ) ) if not options . landmine_scripts : options . landmine_scripts = [ os . path . join ( options . src_dir , 'build' , 'get_landmines.py' ) ] extra_script = os . environ . get ( 'EXTRA_LANDMINES_SCRIPT' ) if extra_script : options . landmine_scripts += [ extra_script ] return options