Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: bootstrap/remove_orphaned_pycs.py

Issue 2061263003: add basic bootstrap for coverage (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Fix recipes readme. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bootstrap/deps.pyl ('k') | bootstrap/util.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file.
5
6 import logging
7 import os
8 import sys
9
10
11 def main(argv):
12 logging.basicConfig(level=logging.INFO)
13 if len(argv) == 0:
14 bootstrap_dir = os.path.dirname(os.path.abspath(__file__))
15 infra_dir = os.path.dirname(bootstrap_dir)
16 argv = [infra_dir]
17
18 for root in argv:
19 # This could take an argument, except gclient DEPS has no good way to pass
20 # us an argument, and gclient getcwd() is ../ from our .gclient file. :(
21 logging.debug("Cleaning orphaned *.pyc files from: %s" % root)
22
23 for (dirpath, _, filenames) in os.walk(root):
24 fnset = set(filenames)
25 for filename in filenames:
26 if filename.endswith(".pyc") and filename[:-1] not in fnset:
27 path = os.path.join(dirpath, filename)
28 logging.info("Deleting orphan *.pyc file: %s" % path)
29 os.remove(path)
30
31
32 if __name__ == '__main__':
33 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « bootstrap/deps.pyl ('k') | bootstrap/util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698