Mercurial > hgrepos > Python > apps > py-cutils
comparison cutils/shasum.py @ 164:a813094ae4f5
Move PY2 from cutils.util.constants into cutils.util
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 09 Jan 2025 13:48:57 +0100 |
| parents | 1e5127028254 |
| children | ffd14e2de130 |
comparison
equal
deleted
inserted
replaced
| 163:fa7dd54e9715 | 164:a813094ae4f5 |
|---|---|
| 22 import re | 22 import re |
| 23 import sys | 23 import sys |
| 24 | 24 |
| 25 from . import (__version__, __revision__) | 25 from . import (__version__, __revision__) |
| 26 from . import util | 26 from . import util |
| 27 from .util import constants | |
| 28 from .util import digest | 27 from .util import digest |
| 29 | 28 |
| 30 | 29 |
| 31 def main(argv=None): | 30 def main(argv=None): |
| 32 aparser = argparse.ArgumentParser( | 31 aparser = argparse.ArgumentParser( |
| 172 opts.algorithm[1], | 171 opts.algorithm[1], |
| 173 True, | 172 True, |
| 174 opts.base64) | 173 opts.base64) |
| 175 else: | 174 else: |
| 176 if not opts.files or (len(opts.files) == 1 and opts.files[0] == '-'): | 175 if not opts.files or (len(opts.files) == 1 and opts.files[0] == '-'): |
| 177 if constants.PY2: | 176 if util.PY2: |
| 178 if sys.platform == "win32": | 177 if sys.platform == "win32": |
| 179 import msvcrt # noqa: E401 | 178 import msvcrt # noqa: E401 |
| 180 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) | 179 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) |
| 181 source = sys.stdin | 180 source = sys.stdin |
| 182 else: | 181 else: |
| 241 | 240 |
| 242 def verify_digests_with_checklist(opts): | 241 def verify_digests_with_checklist(opts): |
| 243 dest = opts.dest or sys.stdout | 242 dest = opts.dest or sys.stdout |
| 244 exit_code = 0 | 243 exit_code = 0 |
| 245 if not opts.files or (len(opts.files) == 1 and opts.files[0] == '-'): | 244 if not opts.files or (len(opts.files) == 1 and opts.files[0] == '-'): |
| 246 if constants.PY2: | 245 if util.PY2: |
| 247 if sys.platform == "win32": | 246 if sys.platform == "win32": |
| 248 import os, msvcrt # noqa: E401 | 247 import os, msvcrt # noqa: E401 |
| 249 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) | 248 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) |
| 250 source = sys.stdin | 249 source = sys.stdin |
| 251 else: | 250 else: |
