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 This copy will resolve symlinks on all platforms, which is useful for Apprtc | 8 This copy will resolve symlinks on all platforms, which is useful for Apprtc |
9 since it uses symlinks for its common javascript files (and Windows does not | 9 since it uses symlinks for its common javascript files (and Windows does not |
10 understand those symlinks). | 10 understand those symlinks). |
11 """ | 11 """ |
12 | 12 |
| 13 import fileinput |
13 import os | 14 import os |
14 import shutil | 15 import shutil |
| 16 import sys |
15 | 17 |
16 import utils | 18 import utils |
17 | 19 |
18 if __name__ == '__main__': | 20 |
19 target_dir = os.path.join('src', 'out', 'webrtc-samples') | 21 def _ConfigureApprtcServerToDeveloperMode(apprtc_dir): |
20 if utils.GetPlatform() is 'win': | 22 app_yaml_path = os.path.join(apprtc_dir, 'app.yaml') |
21 # Work around the fact that node_modules create ridiculously long paths. | 23 if not os.path.exists(app_yaml_path): |
22 # Unfortunately shutil will choke on those on Windows, but not rmdir. | 24 return 'Expected app.yaml at %s.' % os.path.abspath(app_yaml_path) |
23 os.system('rmdir /s /q %s' % target_dir) | 25 |
24 else: | 26 for line in fileinput.input(app_yaml_path, inplace=True): |
25 shutil.rmtree(target_dir, ignore_errors=True) | 27 # We can't click past these in the firefox interop test, so |
| 28 # disable them. |
| 29 line = line.replace('BYPASS_JOIN_CONFIRMATION: false', |
| 30 'BYPASS_JOIN_CONFIRMATION: true') |
| 31 sys.stdout.write(line) |
| 32 |
| 33 |
| 34 def _CopyApprtcToTargetDir(target_dir, apprtc_subdir): |
| 35 shutil.rmtree(target_dir, ignore_errors=True) |
26 shutil.copytree('webrtc-samples', | 36 shutil.copytree('webrtc-samples', |
27 target_dir, ignore=shutil.ignore_patterns('.svn', '.git')) | 37 target_dir, ignore=shutil.ignore_patterns('.svn', '.git')) |
28 apprtc_subdir = os.path.join('samples', 'web', 'content', 'apprtc') | |
29 | 38 |
30 # This file is symlinked on windows, so copy it since win doesn't understand | 39 # This file is symlinked on windows, so copy it since win doesn't understand |
31 # symlinks. | 40 # symlinks. |
32 shutil.copyfile(os.path.join('webrtc-samples', 'samples', 'web', | 41 shutil.copyfile(os.path.join('webrtc-samples', 'samples', 'web', |
33 'js', 'adapter.js'), | 42 'js', 'adapter.js'), |
34 os.path.join(target_dir, apprtc_subdir, 'js', 'adapter.js')) | 43 os.path.join(target_dir, apprtc_subdir, 'js', 'adapter.js')) |
| 44 |
| 45 |
| 46 def main(): |
| 47 target_dir = os.path.join('src', 'out', 'webrtc-samples') |
| 48 apprtc_subdir = os.path.join('samples', 'web', 'content', 'apprtc') |
| 49 _CopyApprtcToTargetDir(target_dir, apprtc_subdir) |
| 50 _ConfigureApprtcServerToDeveloperMode(os.path.join(target_dir, apprtc_subdir)) |
| 51 |
| 52 if __name__ == '__main__': |
| 53 sys.exit(main()) |
| 54 |
OLD | NEW |