mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
c7d5711688
Cleans up Python Code in Build Tools TEST: build everything and run tests BUG: https://code.google.com/p/dart/issues/detail?id=19592 R=ricow@google.com Review URL: https://codereview.chromium.org//350483003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38573 260f80e4-7a28-3924-810f-c04153c831b5
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
#!/usr/bin/env python
|
|
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
"""Tool for listing the directories under pkg, with their lib directories.
|
|
Used in pkg.gyp. Lists all of the directories in the directory passed in as an
|
|
argument to this script which have a lib subdirectory.
|
|
|
|
Usage:
|
|
python tools/list_pkg_directories.py OPTIONS DIRECTORY
|
|
"""
|
|
|
|
import optparse
|
|
import os
|
|
import sys
|
|
|
|
def get_options():
|
|
result = optparse.OptionParser()
|
|
result.add_option("--exclude",
|
|
help='A comma-separated list of directory names to exclude.')
|
|
return result.parse_args()
|
|
|
|
def main(argv):
|
|
(options, args) = get_options()
|
|
directory = args[0]
|
|
exclude = options.exclude.split(',') if options.exclude else []
|
|
|
|
paths = [
|
|
path + '/lib' for path in os.listdir(directory)
|
|
if path not in exclude and os.path.isdir(os.path.join(directory, path))
|
|
]
|
|
|
|
for lib in filter(lambda x: os.path.exists(os.path.join(directory, x)),
|
|
paths):
|
|
print '%s/%s' % (directory, lib)
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main(sys.argv))
|