OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """Moves Apprtc to the out/ directory, where the browser test can find it.""" | 6 """Moves Apprtc to the out/ directory, where the browser test can find it.""" |
7 | 7 |
8 import fileinput | 8 import fileinput |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
11 import sys | 11 import sys |
12 | 12 |
| 13 import utils |
| 14 |
13 | 15 |
14 def _ConfigureApprtcServerToDeveloperMode(app_yaml_path): | 16 def _ConfigureApprtcServerToDeveloperMode(app_yaml_path): |
15 if not os.path.exists(app_yaml_path): | 17 if not os.path.exists(app_yaml_path): |
16 return 'Expected app.yaml at %s.' % os.path.abspath(app_yaml_path) | 18 return 'Expected app.yaml at %s.' % os.path.abspath(app_yaml_path) |
17 | 19 |
18 for line in fileinput.input(app_yaml_path, inplace=True): | 20 for line in fileinput.input(app_yaml_path, inplace=True): |
19 # We can't click past these in the firefox interop test, so | 21 # We can't click past these in the firefox interop test, so |
20 # disable them. | 22 # disable them. |
21 line = line.replace('BYPASS_JOIN_CONFIRMATION: false', | 23 line = line.replace('BYPASS_JOIN_CONFIRMATION: false', |
22 'BYPASS_JOIN_CONFIRMATION: true') | 24 'BYPASS_JOIN_CONFIRMATION: true') |
23 sys.stdout.write(line) | 25 sys.stdout.write(line) |
24 | 26 |
25 | 27 |
26 def main(): | 28 def main(): |
27 target_dir = os.path.join('src', 'out', 'apprtc') | 29 target_dir = os.path.join('src', 'out', 'apprtc') |
28 shutil.rmtree(target_dir, ignore_errors=True) | 30 if utils.GetPlatform() is 'win': |
| 31 # Windows shutil can't handle the long node.js paths when deleting; |
| 32 # work around the problem. |
| 33 os.system('rmdir /s /q %s' % target_dir) |
| 34 else: |
| 35 shutil.rmtree(target_dir, ignore_errors=True) |
29 shutil.copytree('apprtc', | 36 shutil.copytree('apprtc', |
30 target_dir, ignore=shutil.ignore_patterns('.svn', '.git')) | 37 target_dir, ignore=shutil.ignore_patterns('.svn', '.git')) |
31 | 38 |
32 app_yaml_path = os.path.join(target_dir, 'src', 'app_engine', 'app.yaml') | 39 app_yaml_path = os.path.join(target_dir, 'src', 'app_engine', 'app.yaml') |
33 _ConfigureApprtcServerToDeveloperMode(app_yaml_path) | 40 _ConfigureApprtcServerToDeveloperMode(app_yaml_path) |
34 | 41 |
35 | 42 |
36 if __name__ == '__main__': | 43 if __name__ == '__main__': |
37 sys.exit(main()) | 44 sys.exit(main()) |
38 | 45 |
OLD | NEW |