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 os |
13 import shutil | 14 import shutil |
14 | 15 |
| 16 import utils |
15 | 17 |
16 if __name__ == '__main__': | 18 if __name__ == '__main__': |
17 web_samples_dir = 'webrtc-samples/samples/web' | 19 target_dir = os.path.join('src', 'out', 'webrtc-samples') |
18 shutil.rmtree('src/out/apprtc', ignore_errors=True) | 20 if utils.GetPlatform() is 'win': |
19 shutil.copytree(web_samples_dir + '/content/apprtc', | 21 # Work around the fact that node_modules create ridiculously long paths. |
20 'src/out/apprtc', ignore=shutil.ignore_patterns('.svn')) | 22 # Unfortunately shutil will choke on those on Windows, but not rmdir. |
21 shutil.copyfile(web_samples_dir + '/js/adapter.js', | 23 os.system('rmdir /s /q %s' % target_dir) |
22 » » 'src/out/apprtc/js/adapter.js') | 24 else: |
| 25 shutil.rmtree(target_dir, ignore_errors=True) |
| 26 shutil.copytree('webrtc-samples', |
| 27 target_dir, ignore=shutil.ignore_patterns('.svn', '.git')) |
| 28 apprtc_subdir = os.path.join('samples', 'web', 'content', 'apprtc') |
| 29 |
| 30 # This file is symlinked on windows, so copy it since win doesn't understand |
| 31 # symlinks. |
| 32 shutil.copyfile(os.path.join('webrtc-samples', 'samples', 'web', |
| 33 'js', 'adapter.js'), |
| 34 os.path.join(target_dir, apprtc_subdir, 'js', 'adapter.js')) |
OLD | NEW |