Sha256: bbf0e985f450522710a7845b7d74c6647f0f3ad90f1bd6dfcfab4515ea784f82

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env python

# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Utility functions for Windows builds.

These functions are executed via gyp-win-tool when using the ninja generator.
"""

import os
import shutil
import sys


def main(args):
  executor = WinTool()
  exit_code = executor.Dispatch(args)
  if exit_code is not None:
    sys.exit(exit_code)


class WinTool(object):
  """This class performs all the Windows tooling steps. The methods can either
  be executed directly, or dispatched from an argument list."""

  def Dispatch(self, args):
    """Dispatches a string command to a method."""
    if len(args) < 1:
      raise Exception("Not enough arguments")

    method = "Exec%s" % self._CommandifyName(args[0])
    return getattr(self, method)(*args[1:])

  def _CommandifyName(self, name_string):
    """Transforms a tool name like recursive-mirror to RecursiveMirror."""
    return name_string.title().replace('-', '')

  def ExecRecursiveMirror(self, source, dest):
    """Emulation of rm -rf out && cp -af in out."""
    if os.path.exists(dest):
      if os.path.isdir(dest):
        shutil.rmtree(dest)
      else:
        os.unlink(dest)
    if os.path.isdir(source):
      shutil.copytree(source, dest)
    else:
      shutil.copy2(source, dest)


if __name__ == '__main__':
  sys.exit(main(sys.argv[1:]))

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
libv8-3.11.8.17 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.16 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.13 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.12 vendor/v8/build/gyp/pylib/gyp/win_tool.py
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/libv8-3.11.8.4/vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.11 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.10 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.9 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.8 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.7 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.4 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-freebsd-3.11.8.3 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.3 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.1 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.11.8.0 vendor/v8/build/gyp/pylib/gyp/win_tool.py
libv8-3.10.8.0 vendor/v8/build/gyp/pylib/gyp/win_tool.py