parameters: (flavor, out_path)
docstring: Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it
    to |out_path|.
docstring_summary: Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it
    to |out_path|.
docstring_tokens: Finds ( flock|mac|win ) _tool . gyp in the gyp directory and copies it to |out_path| .
function: def CopyTool(flavor, out_path):
    """Finds (flock|mac|win)_tool.gyp in the gyp directory and copies it
    to |out_path|."""
    # aix and solaris just need flock emulation. mac and win use more complicated
    # support scripts.
    prefix = {
        'aix': 'flock',
        'solaris': 'flock',
        'mac': 'mac',
        'win': 'win'
        }.get(flavor, None)
    if not prefix:
      return
  
    # Slurp input file.
    source_path = os.path.join(
        os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix)
    with open(source_path) as source_file:
      source = source_file.readlines()
  
    # Add header and write it out.
    tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix)
    with open(tool_path, 'w') as tool_file:
      tool_file.write(
          ''.join([source[0], '# Generated by gyp. Do not edit.\n'] + source[1:]))
  
    # Make file executable.
    os.chmod(tool_path, 0755)
function_tokens: def CopyTool ( flavor , out_path ) : # aix and solaris just need flock emulation. mac and win use more complicated # support scripts. prefix = { 'aix' : 'flock' , 'solaris' : 'flock' , 'mac' : 'mac' , 'win' : 'win' } . get ( flavor , None ) if not prefix : return # Slurp input file. source_path = os . path . join ( os . path . dirname ( os . path . abspath ( __file__ ) ) , '%s_tool.py' % prefix ) with open ( source_path ) as source_file : source = source_file . readlines ( ) # Add header and write it out. tool_path = os . path . join ( out_path , 'gyp-%s-tool' % prefix ) with open ( tool_path , 'w' ) as tool_file : tool_file . write ( '' . join ( [ source [ 0 ] , '# Generated by gyp. Do not edit.\n' ] + source [ 1 : ] ) ) # Make file executable. os . chmod ( tool_path , 0755 )