parameters: (utilityPath)
docstring: dumps a screenshot of the entire screen to a directory specified by
    the MOZ_UPLOAD_DIR environment variable
docstring_summary: dumps a screenshot of the entire screen to a directory specified by
    the MOZ_UPLOAD_DIR environment variable
docstring_tokens: dumps a screenshot of the entire screen to a directory specified by the MOZ_UPLOAD_DIR environment variable
function: def dumpScreen(utilityPath):
    """dumps a screenshot of the entire screen to a directory specified by
    the MOZ_UPLOAD_DIR environment variable"""
  
    # Need to figure out which OS-dependent tool to use
    if mozinfo.isUnix:
      utility = [os.path.join(utilityPath, "screentopng")]
      utilityname = "screentopng"
    elif mozinfo.isMac:
      utility = ['/usr/sbin/screencapture', '-C', '-x', '-t', 'png']
      utilityname = "screencapture"
    elif mozinfo.isWin:
      utility = [os.path.join(utilityPath, "screenshot.exe")]
      utilityname = "screenshot"
  
    # Get dir where to write the screenshot file
    parent_dir = os.environ.get('MOZ_UPLOAD_DIR', None)
    if not parent_dir:
      log.info('Failed to retrieve MOZ_UPLOAD_DIR env var')
      return
  
    # Run the capture
    try:
      tmpfd, imgfilename = tempfile.mkstemp(prefix='mozilla-test-fail-screenshot_', suffix='.png', dir=parent_dir)
      os.close(tmpfd)
      returncode = subprocess.call(utility + [imgfilename])
      printstatus(returncode, utilityname)
    except OSError, err:
      log.info("Failed to start %s for screenshot: %s" %
               utility[0], err.strerror)
      return
function_tokens: def dumpScreen ( utilityPath ) : # Need to figure out which OS-dependent tool to use if mozinfo . isUnix : utility = [ os . path . join ( utilityPath , "screentopng" ) ] utilityname = "screentopng" elif mozinfo . isMac : utility = [ '/usr/sbin/screencapture' , '-C' , '-x' , '-t' , 'png' ] utilityname = "screencapture" elif mozinfo . isWin : utility = [ os . path . join ( utilityPath , "screenshot.exe" ) ] utilityname = "screenshot" # Get dir where to write the screenshot file parent_dir = os . environ . get ( 'MOZ_UPLOAD_DIR' , None ) if not parent_dir : log . info ( 'Failed to retrieve MOZ_UPLOAD_DIR env var' ) return # Run the capture try : tmpfd , imgfilename = tempfile . mkstemp ( prefix = 'mozilla-test-fail-screenshot_' , suffix = '.png' , dir = parent_dir ) os . close ( tmpfd ) returncode = subprocess . call ( utility + [ imgfilename ] ) printstatus ( returncode , utilityname ) except OSError , err : log . info ( "Failed to start %s for screenshot: %s" % utility [ 0 ] , err . strerror ) return