Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
update_sources.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2#
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
5# BSD-style license that can be found in the LICENSE file.
6
7# Updates the list of Observatory source files.
8
9import os
10import sys
11from datetime import date
12
13
14def getDir(rootdir, target):
15 sources = []
16 for root, subdirs, files in os.walk(rootdir):
17 subdirs.sort()
18 files.sort()
19 for f in files:
20 sources.append(root + '/' + f)
21 return sources
22
23
24HEADER = """# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
25# for details. All rights reserved. Use of this source code is governed by a
26# BSD-style license that can be found in the LICENSE file.
27
28# DO NOT EDIT. This file is generated by update_sources.py in this directory.
29
30# This file contains all dart, css, and html sources for Observatory.
31"""
32
33
34def main():
35 with open('observatory_sources.gni', 'w') as target:
36 target.write(HEADER)
37 target.write('observatory_sources = [\n')
38 sources = []
39 for rootdir in ['lib', 'web']:
40 sources.extend(getDir(rootdir, target))
41 sources.sort()
42 for s in sources:
43 if (s[-9:] != 'README.md'):
44 target.write(' "' + s + '",\n')
45 target.write(']\n')
46
47
48if __name__ == "__main__":
49 main()
Definition main.py:1
getDir(rootdir, target)