OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 # IMPORTANT NOTE: If you make local mods to this file, you must run: | 6 # IMPORTANT NOTE: If you make local mods to this file, you must run: |
7 # % tools/llvm/utman.sh driver | 7 # % tools/llvm/utman.sh driver |
8 # in order for them to take effect in the scons build. This command | 8 # in order for them to take effect in the scons build. This command |
9 # updates the copy in the toolchain/ tree. | 9 # updates the copy in the toolchain/ tree. |
10 # | 10 # |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 def normalize(syspath): | 39 def normalize(syspath): |
40 """ Convert an input path into a normalized path. """ | 40 """ Convert an input path into a normalized path. """ |
41 | 41 |
42 if WINDOWS_MANGLE: | 42 if WINDOWS_MANGLE: |
43 # Recognize paths which are already normalized. | 43 # Recognize paths which are already normalized. |
44 # (Should only happen during recursive driver calls) | 44 # (Should only happen during recursive driver calls) |
45 if syspath.startswith('/cygdrive/'): | 45 if syspath.startswith('/cygdrive/'): |
46 return syspath | 46 return syspath |
47 | 47 |
| 48 # Leave '-' alone since it represents stdout and not a real path. |
| 49 if syspath == '-': |
| 50 return syspath |
| 51 |
48 components = os.path.abspath(syspath).split('\\') | 52 components = os.path.abspath(syspath).split('\\') |
49 drive = components[0] | 53 drive = components[0] |
50 components = components[1:] | 54 components = components[1:] |
51 assert(len(drive) == 2 and drive[1] == ':') | 55 assert(len(drive) == 2 and drive[1] == ':') |
52 return '/cygdrive/%s/%s' % (drive[0].lower(), '/'.join(components)) | 56 return '/cygdrive/%s/%s' % (drive[0].lower(), '/'.join(components)) |
53 else: | 57 else: |
54 return syspath | 58 return syspath |
55 | 59 |
56 # All functions below expect a normalized path as input | 60 # All functions below expect a normalized path as input |
57 | 61 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 return posixpath.abspath(npath) | 103 return posixpath.abspath(npath) |
100 | 104 |
101 def isdir(npath): | 105 def isdir(npath): |
102 return os.path.isdir(tosys(npath)) | 106 return os.path.isdir(tosys(npath)) |
103 | 107 |
104 def isfile(npath): | 108 def isfile(npath): |
105 return os.path.isfile(tosys(npath)) | 109 return os.path.isfile(tosys(npath)) |
106 | 110 |
107 def getsize(npath): | 111 def getsize(npath): |
108 return os.path.getsize(tosys(npath)) | 112 return os.path.getsize(tosys(npath)) |
OLD | NEW |