Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 '''Tool for listing the directories under pkg, with their lib directories. | 6 '''Tool for listing the directories under pkg, with their lib directories. |
| 7 Used in pkg.gyp. Lists all of the directories in the current directory | 7 Used in pkg.gyp. Lists all of the directories in the current directory |
|
Bob Nystrom
2013/07/08 16:40:08
Update this since now it doesn't look in the curre
Emily Fortuna
2013/07/08 17:36:30
Done. Looks like this was already a bit out of dat
| |
| 8 which have a lib subdirectory. | 8 which have a lib subdirectory. |
| 9 | 9 |
| 10 Usage: | 10 Usage: |
| 11 python tools/list_pkg_directories.py | 11 python tools/list_pkg_directories.py |
| 12 ''' | 12 ''' |
| 13 | 13 |
| 14 import os | 14 import os |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 def main(argv): | 17 def main(argv): |
| 18 paths = map(lambda x: x + '/lib', filter(os.path.isdir, os.listdir(argv[1]))) | 18 paths = map(lambda x: x + '/lib', filter(lambda x: os.path.isdir( |
| 19 for lib in filter(lambda x: os.path.exists(x), paths): | 19 os.path.join(argv[1], x)), os.listdir(argv[1]))) |
|
Bob Nystrom
2013/07/08 16:40:08
Make a variable for argv[1] so it's clear what it'
Emily Fortuna
2013/07/08 17:36:30
Done.
| |
| 20 print lib | 20 for lib in filter(lambda x: os.path.exists(os.path.join(argv[1], x)), paths): |
| 21 print os.path.join(argv[1], lib) | |
| 21 | 22 |
| 22 if __name__ == '__main__': | 23 if __name__ == '__main__': |
| 23 sys.exit(main(sys.argv)) | 24 sys.exit(main(sys.argv)) |
| OLD | NEW |