OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 # Updates the list of Observatory source files. | 7 # Updates the list of Observatory source files. |
8 | 8 |
9 import os | 9 import os |
10 import sys | 10 import sys |
11 from datetime import date | 11 from datetime import date |
12 | 12 |
13 def getDir(rootdir, target): | 13 def getDir(rootdir, target): |
14 sources = [] | 14 sources = [] |
15 for root, subdirs, files in os.walk(rootdir): | 15 for root, subdirs, files in os.walk(rootdir): |
16 subdirs.sort() | 16 subdirs.sort() |
17 files.sort() | 17 files.sort() |
18 for f in files: | 18 for f in files: |
19 sources.append(root + '/' + f) | 19 sources.append(root + '/' + f) |
20 return sources | 20 return sources |
| 21 |
| 22 HEADER = """# Copyright (c) 2017, the Dart project authors. Please see the AUTHO
RS file |
| 23 # for details. All rights reserved. Use of this source code is governed by a |
| 24 # BSD-style license that can be found in the LICENSE file. |
| 25 |
| 26 # DO NOT EDIT. This file is generated by update_sources.py in this directory. |
| 27 |
| 28 # This file contains all dart, css, and html sources for Observatory. |
| 29 """ |
21 | 30 |
22 def main(): | 31 def main(): |
23 target = open('observatory_sources.gypi', 'w') | 32 with open('observatory_sources.gni', 'w') as target: |
24 target.write('# Copyright (c) ') | 33 target.write(HEADER) |
25 target.write(str(date.today().year)) | 34 target.write('observatory_sources = [\n') |
26 target.write(', the Dart project authors. Please see the AUTHORS file\n'); | |
27 target.write('# for details. All rights reserved. Use of this source code is
governed by a\n'); | |
28 target.write('# BSD-style license that can be found in the LICENSE file.\n')
; | |
29 target.write('\n'); | |
30 target.write('# This file contains all dart, css, and html sources for Obser
vatory.\n'); | |
31 target.write('{\n \'sources\': [\n') | |
32 sources = [] | 35 sources = [] |
33 for rootdir in ['lib', 'web']: | 36 for rootdir in ['lib', 'web']: |
34 sources.extend(getDir(rootdir, target)) | 37 sources.extend(getDir(rootdir, target)) |
35 sources.sort() | 38 sources.sort() |
36 for s in sources: | 39 for s in sources: |
37 if (s[-9:] != 'README.md'): | 40 if (s[-9:] != 'README.md'): |
38 target.write(' \'' + s + '\',\n') | 41 target.write(' "' + s + '",\n') |
39 target.write(' ]\n}\n') | 42 target.write(']\n') |
40 target.close() | |
41 | 43 |
42 if __name__ == "__main__": | 44 if __name__ == "__main__": |
43 main() | 45 main() |
OLD | NEW |