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

Unified Diff: tools/list_pkg_directories.py

Issue 397773002: Create a separate packages directory for running pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: tools/list_pkg_directories.py
diff --git a/tools/list_pkg_directories.py b/tools/list_pkg_directories.py
index f1b69f19623218478f3da1912f67df13f29e0ae6..d64604be17ad1e0005b20ae5a9b73bfc16a0ce6c 100644
--- a/tools/list_pkg_directories.py
+++ b/tools/list_pkg_directories.py
@@ -8,16 +8,29 @@ 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 directory_to_list
+ 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):
- directory = argv[1]
- paths = map(lambda x: x + '/lib', filter(lambda x: os.path.isdir(
- os.path.join(directory, x)), os.listdir(directory)))
+ (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)

Powered by Google App Engine
This is Rietveld 408576698