[game-data-packager] 11/25: make_template: caculate sums for single file
Simon McVittie
smcv at debian.org
Wed Feb 4 10:01:35 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit a3eb1e0341418bb8204bd1f6e08d04ee5fc0862b
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Wed Jan 28 17:46:26 2015 +0100
make_template: caculate sums for single file
---
game_data_packager/make_template.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/game_data_packager/make_template.py b/game_data_packager/make_template.py
index 16ec749..82000a4 100644
--- a/game_data_packager/make_template.py
+++ b/game_data_packager/make_template.py
@@ -91,6 +91,16 @@ def do_one_dir(destdir,lower):
print('...')
print('')
+def do_one_file(name,lower):
+ hf = HashedFile.from_file(name, open(name, 'rb'))
+ out_name = os.path.basename(name)
+ if lower:
+ out_name = out_name.lower()
+ print(' _ %-9s %s' % (os.path.getsize(name), out_name))
+ print(' %s %s' % (hf.md5, out_name))
+ print(' %s %s' % (hf.sha1, out_name))
+ print(' %s %s' % (hf.sha256, out_name))
+
def do_one_deb(deb):
control = None
@@ -208,8 +218,10 @@ def main():
for arg in args.args:
if os.path.isdir(arg):
do_one_dir(arg.rstrip('/'),args.lower)
- else:
+ elif arg.endswith('.deb'):
do_one_deb(arg)
+ else:
+ do_one_file(arg,args.lower)
if __name__ == '__main__':
main()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list