OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, 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 # Create the compiler_unsupported package. This will copy the | 7 # Create the compiler_unsupported package. This will copy the |
8 # sdk/lib/_internal/compiler directory and the libraries.dart file into lib/. | 8 # sdk/lib/_internal/compiler directory and the libraries.dart file into lib/. |
9 # | 9 # |
10 # Usage: create_library.py | 10 # Usage: create_library.py |
(...skipping 26 matching lines...) Expand all Loading... |
37 def Main(argv): | 37 def Main(argv): |
38 # pkg/compiler_unsupported | 38 # pkg/compiler_unsupported |
39 HOME = dirname(dirname(os.path.realpath(__file__))) | 39 HOME = dirname(dirname(os.path.realpath(__file__))) |
40 | 40 |
41 # pkg/compiler_unsupported/lib | 41 # pkg/compiler_unsupported/lib |
42 TARGET = join(HOME, 'lib') | 42 TARGET = join(HOME, 'lib') |
43 | 43 |
44 # sdk/lib/_internal | 44 # sdk/lib/_internal |
45 SOURCE = join(dirname(dirname(HOME)), 'sdk', 'lib', '_internal') | 45 SOURCE = join(dirname(dirname(HOME)), 'sdk', 'lib', '_internal') |
46 | 46 |
| 47 # pkg |
| 48 PKG_SOURCE = join(dirname(dirname(HOME)), 'pkg') |
| 49 |
47 # clean compiler_unsupported/lib | 50 # clean compiler_unsupported/lib |
48 if not os.path.exists(TARGET): | 51 if not os.path.exists(TARGET): |
49 os.mkdir(TARGET) | 52 os.mkdir(TARGET) |
50 shutil.rmtree(join(TARGET, 'implementation'), True) | 53 shutil.rmtree(join(TARGET, 'src'), True) |
51 RemoveFile(join(TARGET, 'compiler.dart')) | 54 RemoveFile(join(TARGET, 'compiler.dart')) |
52 RemoveFile(join(TARGET, 'libraries.dart')) | 55 RemoveFile(join(TARGET, 'libraries.dart')) |
53 | 56 |
54 # copy dart2js code | 57 # copy dart2js code |
55 shutil.copy(join(SOURCE, 'compiler', 'compiler.dart'), TARGET) | 58 shutil.copy(join(PKG_SOURCE, 'compiler', 'lib', 'compiler.dart'), TARGET) |
56 shutil.copy(join(SOURCE, 'libraries.dart'), TARGET) | 59 shutil.copy(join(SOURCE, 'libraries.dart'), TARGET) |
57 shutil.copytree( | 60 shutil.copytree( |
58 join(SOURCE, 'compiler', 'implementation'), | 61 join(PKG_SOURCE, 'compiler', 'lib', 'src'), |
59 join(TARGET, 'implementation')) | 62 join(TARGET, 'src')) |
60 | 63 |
61 # patch up the libraries.dart references | 64 # patch up the libraries.dart references |
62 replace = [(r'\.\./\.\./libraries\.dart', r'\.\./libraries\.dart')] | 65 replace = [(r'\.\./\.\./libraries\.dart', r'\.\./libraries\.dart')] |
63 | 66 |
64 for root, dirs, files in os.walk(join(TARGET, 'implementation')): | 67 for root, dirs, files in os.walk(join(TARGET, 'src')): |
65 for name in files: | 68 for name in files: |
66 if name.endswith('.dart'): | 69 if name.endswith('.dart'): |
67 ReplaceInFiles([join(root, name)], replace) | 70 ReplaceInFiles([join(root, name)], replace) |
68 | 71 |
69 | 72 |
70 if __name__ == '__main__': | 73 if __name__ == '__main__': |
71 sys.exit(Main(sys.argv)) | 74 sys.exit(Main(sys.argv)) |
OLD | NEW |