OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium 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 """Prints all non-system dependencies for the given module. | 6 """Prints all non-system dependencies for the given module. |
7 | 7 |
8 The primary use-case for this script is to genererate the list of python modules | 8 The primary use-case for this script is to genererate the list of python modules |
9 required for .isolate files. | 9 required for .isolate files. |
10 """ | 10 """ |
(...skipping 20 matching lines...) Expand all Loading... | |
31 if m and hasattr(m, '__file__')) | 31 if m and hasattr(m, '__file__')) |
32 | 32 |
33 src_paths = set() | 33 src_paths = set() |
34 for path in module_paths: | 34 for path in module_paths: |
35 if path == __file__: | 35 if path == __file__: |
36 continue | 36 continue |
37 path = os.path.abspath(path) | 37 path = os.path.abspath(path) |
38 if not path.startswith(_SRC_ROOT): | 38 if not path.startswith(_SRC_ROOT): |
39 continue | 39 continue |
40 | 40 |
41 if path.endswith('.pyc'): | 41 if path.endswith('c') and os.path.exists(path[:-1]): |
agrieve
2017/04/26 18:19:44
nit: can you put this back to ".pyc" just so that
jbudorick
2017/04/26 19:34:22
The pyc files only end in '.pyc' if the correspond
agrieve
2017/04/27 00:30:18
did not know that!
| |
42 path = path[:-1] | 42 path = path[:-1] |
43 src_paths.add(path) | 43 src_paths.add(path) |
44 | 44 |
45 return src_paths | 45 return src_paths |
46 | 46 |
47 | 47 |
48 def _NormalizeCommandLine(options): | 48 def _NormalizeCommandLine(options): |
49 """Returns a string that when run from SRC_ROOT replicates the command.""" | 49 """Returns a string that when run from SRC_ROOT replicates the command.""" |
50 args = ['build/print_python_deps.py'] | 50 args = ['build/print_python_deps.py'] |
51 root = os.path.relpath(options.root, _SRC_ROOT) | 51 root = os.path.relpath(options.root, _SRC_ROOT) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 out = open(options.output, 'w') if options.output else sys.stdout | 97 out = open(options.output, 'w') if options.output else sys.stdout |
98 with out: | 98 with out: |
99 out.write('# Generated by running:\n') | 99 out.write('# Generated by running:\n') |
100 out.write('# %s\n' % normalized_cmdline) | 100 out.write('# %s\n' % normalized_cmdline) |
101 for path in sorted(paths): | 101 for path in sorted(paths): |
102 out.write(path + '\n') | 102 out.write(path + '\n') |
103 | 103 |
104 | 104 |
105 if __name__ == '__main__': | 105 if __name__ == '__main__': |
106 sys.exit(main()) | 106 sys.exit(main()) |
OLD | NEW |