comparison cutils/shasum.py @ 106:5fe6f63f0be7

Implement "--recurse" and "--follow-symlinks" in "gen_opts()" also
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 30 May 2022 09:15:18 +0200
parents b0631f320efd
children 3060aa4cb252
comparison
equal deleted inserted replaced
105:b0631f320efd 106:5fe6f63f0be7
134 return shasum(opts) 134 return shasum(opts)
135 135
136 136
137 def gen_opts(files=[], algorithm="SHA1", bsd=False, text_mode=False, 137 def gen_opts(files=[], algorithm="SHA1", bsd=False, text_mode=False,
138 checklist=False, check=False, dest=None, base64=False, 138 checklist=False, check=False, dest=None, base64=False,
139 allow_distinfo=False, mmap=None): 139 allow_distinfo=False, mmap=None, recurse=False,
140 follow_symlinks=False):
140 if text_mode: 141 if text_mode:
141 raise ValueError("text mode not supported") 142 raise ValueError("text mode not supported")
142 if checklist and check: 143 if checklist and check:
143 raise ValueError("only one of `checklist' or `check' is allowed") 144 raise ValueError("only one of `checklist' or `check' is allowed")
144 opts = argparse.Namespace(files=files, 145 opts = argparse.Namespace(files=files,
149 check=check, 150 check=check,
150 text_mode=False, 151 text_mode=False,
151 dest=dest, 152 dest=dest,
152 base64=base64, 153 base64=base64,
153 allow_distinfo=allow_distinfo, 154 allow_distinfo=allow_distinfo,
154 mmap=mmap) 155 mmap=mmap,
156 recurse=recurse,
157 follow_symlinks=follow_symlinks)
155 return opts 158 return opts
156 159
157 160
158 def shasum(opts): 161 def shasum(opts):
159 if opts.check: 162 if opts.check: