Chromium Code Reviews| Index: scripts/slave/recipe_modules/webrtc/resources/cleanup_symlinks.py |
| diff --git a/scripts/slave/recipe_modules/webrtc/resources/cleanup_symlinks.py b/scripts/slave/recipe_modules/webrtc/resources/cleanup_symlinks.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..95c0bf010a72a7f3eca844bb4de41b6715c4a564 |
| --- /dev/null |
| +++ b/scripts/slave/recipe_modules/webrtc/resources/cleanup_symlinks.py |
| @@ -0,0 +1,36 @@ |
| +#!/usr/bin/env python |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +"""Script that deletes all symlinks created by setup_links.py in a checkout.""" |
| + |
| +import os |
| +import subprocess |
| +import sys |
| + |
| + |
| +def main(args): |
| + if not args or len(args) != 1: |
|
Michael Achenbach
2016/11/08 09:11:47
nit:
if len(args) != 1:
should be enough, since th
kjellander_chromium
2016/11/08 11:04:40
Done.
|
| + print >> sys.stderr, 'Please specify a single directory as an argument.' |
| + return 1 |
| + |
| + checkout_dir = args[0] |
| + if not os.path.isdir(checkout_dir): |
| + print 'Cannot find any directory at %s. Skipping cleaning.' % checkout_dir |
| + return 0 |
| + |
| + setup_links_file = os.path.join(checkout_dir, 'setup_links.py') |
| + if not os.path.isfile(setup_links_file): |
|
Michael Achenbach
2016/11/08 09:11:47
Does "isfile" imply "exists"? Or can it raise?
ehmaldonado_chromium
2016/11/08 10:43:25
It doesn't raise.
kjellander_chromium
2016/11/08 11:04:40
Acknowledged.
|
| + print 'Cannot find %s. Incomplete checkout?' % setup_links_file |
| + return 1 |
| + else: |
| + print 'Cleaning up symlinks in %s' % checkout_dir |
| + subprocess.check_call([sys.executable, setup_links_file, '--clean-only'], |
| + cwd=checkout_dir) |
| + return 0 |
| + |
| + |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main(sys.argv[1:])) |