|
18 | 18 | """Copy files from source to dest expanding symlinks along the way.
|
19 | 19 | """
|
20 | 20 |
|
21 |
| -from shutil import copytree |
22 |
| - |
23 | 21 | import argparse
|
| 22 | +from shutil import copytree |
24 | 23 | import sys
|
25 | 24 |
|
26 |
| - |
27 | 25 | # Ignore these files and directories when copying over files into the snapshot.
|
28 |
| -IGNORE = set(['.hg', 'httplib2', 'oauth2', 'simplejson', 'static']) |
| 26 | +IGNORE = set([".hg", "httplib2", "oauth2", "simplejson", "static"]) |
29 | 27 |
|
30 | 28 | # In addition to the above files also ignore these files and directories when
|
31 | 29 | # copying over samples into the snapshot.
|
32 |
| -IGNORE_IN_SAMPLES = set(['googleapiclient', 'oauth2client', 'uritemplate']) |
| 30 | +IGNORE_IN_SAMPLES = set(["googleapiclient", "oauth2client", "uritemplate"]) |
33 | 31 |
|
34 | 32 | parser = argparse.ArgumentParser(description=__doc__)
|
35 | 33 |
|
36 |
| -parser.add_argument('--source', default='.', |
37 |
| - help='Directory name to copy from.') |
| 34 | +parser.add_argument("--source", default=".", help="Directory name to copy from.") |
38 | 35 |
|
39 |
| -parser.add_argument('--dest', default='snapshot', |
40 |
| - help='Directory name to copy to.') |
| 36 | +parser.add_argument("--dest", default="snapshot", help="Directory name to copy to.") |
41 | 37 |
|
42 | 38 |
|
43 | 39 | def _ignore(path, names):
|
44 |
| - retval = set() |
45 |
| - if path != '.': |
46 |
| - retval = retval.union(IGNORE_IN_SAMPLES.intersection(names)) |
47 |
| - retval = retval.union(IGNORE.intersection(names)) |
48 |
| - return retval |
| 40 | + retval = set() |
| 41 | + if path != ".": |
| 42 | + retval = retval.union(IGNORE_IN_SAMPLES.intersection(names)) |
| 43 | + retval = retval.union(IGNORE.intersection(names)) |
| 44 | + return retval |
49 | 45 |
|
50 | 46 |
|
51 | 47 | def main():
|
52 |
| - copytree(FLAGS.source, FLAGS.dest, symlinks=True, |
53 |
| - ignore=_ignore) |
| 48 | + copytree(FLAGS.source, FLAGS.dest, symlinks=True, ignore=_ignore) |
54 | 49 |
|
55 | 50 |
|
56 |
| -if __name__ == '__main__': |
57 |
| - FLAGS = parser.parse_args(sys.argv[1:]) |
58 |
| - main() |
| 51 | +if __name__ == "__main__": |
| 52 | + FLAGS = parser.parse_args(sys.argv[1:]) |
| 53 | + main() |
0 commit comments