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

Unified Diff: recipe_modules/file/resources/fileutil.py

Issue 2993713003: Add file.filesizes to recipe engine core modules. (Closed)
Patch Set: -kwargs. Created 3 years, 4 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
« no previous file with comments | « recipe_modules/file/examples/copytree.expected/basic.json ('k') | recipe_modules/file/test_api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/file/resources/fileutil.py
diff --git a/recipe_modules/file/resources/fileutil.py b/recipe_modules/file/resources/fileutil.py
index c02db54a2026eccaf53c6ef5a7d0142d485476b5..518edaf085d54205265d0356b28982cc6eee3e24 100755
--- a/recipe_modules/file/resources/fileutil.py
+++ b/recipe_modules/file/resources/fileutil.py
@@ -250,6 +250,14 @@ def main(args):
subparser.add_argument('dest', help='The dir to ensure.')
subparser.set_defaults(func=lambda opts: _EnsureDir(opts.mode, opts.dest))
+ # Subcommand: filesizes
+ subparser = subparsers.add_parser('filesizes',
+ help='Prints a list for sizes in bytes (1 per line) for each given file')
+ subparser.add_argument('file', nargs='+', help='Path to a file')
+ subparser.set_defaults(
+ func=lambda opts: print('\n'.join(str(os.stat(f).st_size)
+ for f in opts.file)))
+
# Parse arguments.
opts = parser.parse_args(args)
« no previous file with comments | « recipe_modules/file/examples/copytree.expected/basic.json ('k') | recipe_modules/file/test_api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698