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) |