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

Side by Side Diff: tools/checkdeps/checkdeps.py

Issue 8416016: Fix checkdeps.py to check all the source directories in git checkouts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a comment. Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """Makes sure that files include headers from allowed directories. 6 """Makes sure that files include headers from allowed directories.
7 7
8 Checks DEPS files in the source tree for rules, and applies those rules to 8 Checks DEPS files in the source tree for rules, and applies those rules to
9 "#include" commands in source files. Any source file including something not 9 "#include" commands in source files. Any source file including something not
10 permitted by the DEPS files will fail. 10 permitted by the DEPS files will fail.
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 root: The repository root where .git directory exists. 409 root: The repository root where .git directory exists.
410 410
411 Returns: 411 Returns:
412 A set of directories which contain sources managed by git. 412 A set of directories which contain sources managed by git.
413 """ 413 """
414 git_source_directory = set() 414 git_source_directory = set()
415 popen_out = os.popen("cd %s && git ls-files --full-name ." % 415 popen_out = os.popen("cd %s && git ls-files --full-name ." %
416 pipes.quote(root)) 416 pipes.quote(root))
417 for line in popen_out.readlines(): 417 for line in popen_out.readlines():
418 dir_name = os.path.join(root, os.path.dirname(line)) 418 dir_name = os.path.join(root, os.path.dirname(line))
419 git_source_directory.add(dir_name) 419 # Add the directory as well as all the parent directories.
420 while dir_name != root:
421 git_source_directory.add(dir_name)
422 dir_name = os.path.dirname(dir_name)
420 git_source_directory.add(root) 423 git_source_directory.add(root)
421 return git_source_directory 424 return git_source_directory
422 425
423 426
424 def PrintUsage(): 427 def PrintUsage():
425 print """Usage: python checkdeps.py [--root <root>] [tocheck] 428 print """Usage: python checkdeps.py [--root <root>] [tocheck]
426 --root Specifies the repository root. This defaults to "../../.." relative 429 --root Specifies the repository root. This defaults to "../../.." relative
427 to the script file. This will be correct given the normal location 430 to the script file. This will be correct given the normal location
428 of the script in "<root>/tools/checkdeps". 431 of the script in "<root>/tools/checkdeps".
429 432
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if '__main__' == __name__: 491 if '__main__' == __name__:
489 option_parser = optparse.OptionParser() 492 option_parser = optparse.OptionParser()
490 option_parser.add_option("", "--root", default="", dest="base_directory", 493 option_parser.add_option("", "--root", default="", dest="base_directory",
491 help='Specifies the repository root. This defaults ' 494 help='Specifies the repository root. This defaults '
492 'to "../../.." relative to the script file, which ' 495 'to "../../.." relative to the script file, which '
493 'will normally be the repository root.') 496 'will normally be the repository root.')
494 option_parser.add_option("-v", "--verbose", action="store_true", 497 option_parser.add_option("-v", "--verbose", action="store_true",
495 default=False, help="Print debug logging") 498 default=False, help="Print debug logging")
496 options, args = option_parser.parse_args() 499 options, args = option_parser.parse_args()
497 main(options, args) 500 main(options, args)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698