Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Script that deletes all symlinks created by setup_links.py in a checkout.""" | |
| 7 | |
| 8 import os | |
| 9 import subprocess | |
| 10 import sys | |
| 11 | |
| 12 | |
| 13 def main(args): | |
| 14 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.
| |
| 15 print >> sys.stderr, 'Please specify a single directory as an argument.' | |
| 16 return 1 | |
| 17 | |
| 18 checkout_dir = args[0] | |
| 19 if not os.path.isdir(checkout_dir): | |
| 20 print 'Cannot find any directory at %s. Skipping cleaning.' % checkout_dir | |
| 21 return 0 | |
| 22 | |
| 23 setup_links_file = os.path.join(checkout_dir, 'setup_links.py') | |
| 24 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.
| |
| 25 print 'Cannot find %s. Incomplete checkout?' % setup_links_file | |
| 26 return 1 | |
| 27 else: | |
| 28 print 'Cleaning up symlinks in %s' % checkout_dir | |
| 29 subprocess.check_call([sys.executable, setup_links_file, '--clean-only'], | |
| 30 cwd=checkout_dir) | |
| 31 return 0 | |
| 32 | |
| 33 | |
| 34 | |
| 35 if __name__ == '__main__': | |
| 36 sys.exit(main(sys.argv[1:])) | |
| OLD | NEW |