Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: pylib/gyp/win_tool.py

Issue 9443044: Beginnings of some msvs_... emulation (windows ninja) (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: no pdb option for LIB Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 # Copyright (c) 2012 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Utility functions for Windows builds.
8
9 These functions are executed via gyp-win-tool when using the ninja generator.
10 """
11
12 import os
13 import shutil
14 import sys
15
16
17 def main(args):
18 executor = WinTool()
19 exit_code = executor.Dispatch(args)
20 if exit_code is not None:
21 sys.exit(exit_code)
22
23
24 class WinTool(object):
25 """This class performs all the Windows tooling steps. The methods can either
26 be executed directly, or dispatched from an argument list."""
27
28 def Dispatch(self, args):
29 """Dispatches a string command to a method."""
30 if len(args) < 1:
31 raise Exception("Not enough arguments")
32
33 method = "Exec%s" % self._CommandifyName(args[0])
34 return getattr(self, method)(*args[1:])
35
36 def _CommandifyName(self, name_string):
37 """Transforms a tool name like recursive-mirror to RecursiveMirror."""
38 return name_string.title().replace('-', '')
39
40 def ExecRecursiveMirror(self, source, dest):
41 """Emulation of rm -rf out && cp -af in out."""
42 if os.path.exists(dest):
43 if os.path.isdir(dest):
44 shutil.rmtree(dest)
45 else:
46 os.unlink(dest)
47 if os.path.isdir(source):
48 shutil.copytree(source, dest)
49 else:
50 shutil.copy2(source, dest)
51
52
53 if __name__ == '__main__':
54 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698