| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright 2008, Google Inc. | 2 # Copyright 2008, Google Inc. |
| 3 # All rights reserved. | 3 # All rights reserved. |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 directory at once. This provides more opportunity for hard linking, and | 43 directory at once. This provides more opportunity for hard linking, and |
| 44 also makes the destination files/directories all writable. | 44 also makes the destination files/directories all writable. |
| 45 * Can take sources which contain env.Glob()-style wildcards. | 45 * Can take sources which contain env.Glob()-style wildcards. |
| 46 * Can take multiple target directories; will copy to all of them. | 46 * Can take multiple target directories; will copy to all of them. |
| 47 * Handles duplicate requests. | 47 * Handles duplicate requests. |
| 48 | 48 |
| 49 Args: | 49 Args: |
| 50 env: Environment in which to operate. | 50 env: Environment in which to operate. |
| 51 target: Destination(s) for copy. Must evaluate to a directory via | 51 target: Destination(s) for copy. Must evaluate to a directory via |
| 52 env.Dir(), or a list of directories. If more than one directory is | 52 env.Dir(), or a list of directories. If more than one directory is |
| 53 passed, the entire source list will be copied to all target | 53 passed, the entire source list will be copied to each target |
| 54 directories. | 54 directory. |
| 55 source: Source file(s) to copy. May be a string, Node, or a list of | 55 source: Source file(s) to copy. May be a string, Node, or a list of |
| 56 mixed strings or Nodes. Strings will be passed through env.Glob() to | 56 mixed strings or Nodes. Strings will be passed through env.Glob() to |
| 57 evaluate wildcards. If a source evaluates to a directory, the entire | 57 evaluate wildcards. If a source evaluates to a directory, the entire |
| 58 directory will be recursively copied. | 58 directory will be recursively copied. |
| 59 | 59 |
| 60 From env: | 60 From env: |
| 61 REPLICATE_RENAME: A list of pairs of regex search and replacement strings. | 61 REPLICATE_REPLACE: A list of pairs of regex search and replacement strings. |
| 62 Each full destination path has substitution performed on each pair | 62 Each full destination path has substitution performed on each pair |
| 63 (search_regex, replacement) in order. | 63 (search_regex, replacement) in order. |
| 64 | 64 |
| 65 env.Replicate('destdir', ['footxt.txt'], REPLICATE_REPLACE = [ | 65 env.Replicate('destdir', ['footxt.txt'], REPLICATE_REPLACE = [ |
| 66 ('\\.txt', '.bar'), ('est', 'ist')]) | 66 ('\\.txt', '.bar'), ('est', 'ist')]) |
| 67 will copy to 'distdir/footxt.bar' | 67 will copy to 'distdir/footxt.bar' |
| 68 | 68 |
| 69 In the example above, note the use of \\ to escape the '.' character, | 69 In the example above, note the use of \\ to escape the '.' character, |
| 70 so that it doesn't act like the regexp '.' and match any character. | 70 so that it doesn't act like the regexp '.' and match any character. |
| 71 | 71 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 # Return list of destination nodes | 118 # Return list of destination nodes |
| 119 return dest_nodes | 119 return dest_nodes |
| 120 | 120 |
| 121 | 121 |
| 122 def generate(env): | 122 def generate(env): |
| 123 # NOTE: SCons requires the use of this name, which fails gpylint. | 123 # NOTE: SCons requires the use of this name, which fails gpylint. |
| 124 """SCons entry point for this tool.""" | 124 """SCons entry point for this tool.""" |
| 125 | 125 |
| 126 env.AddMethod(Replicate) | 126 env.AddMethod(Replicate) |
| OLD | NEW |