Mercurial > public > mercurial-scm > hg
comparison contrib/byteify-strings.py @ 42247:970aaf38c3fc
contrib: have byteify-strings explode if run in Python 2
Differential Revision: https://phab.mercurial-scm.org/D6341
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 03 May 2019 15:53:56 -0400 |
parents | da130c5cef90 |
children | 70bd1965bd07 |
comparison
equal
deleted
inserted
replaced
42246:e10b8058da84 | 42247:970aaf38c3fc |
---|---|
5 # Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com> | 5 # Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com> |
6 # | 6 # |
7 # This software may be used and distributed according to the terms of the | 7 # This software may be used and distributed according to the terms of the |
8 # GNU General Public License version 2 or any later version. | 8 # GNU General Public License version 2 or any later version. |
9 | 9 |
10 from __future__ import absolute_import | 10 from __future__ import absolute_import, print_function |
11 | 11 |
12 import argparse | 12 import argparse |
13 import contextlib | 13 import contextlib |
14 import errno | 14 import errno |
15 import os | 15 import os |
225 with open(fname, 'rb') as fin: | 225 with open(fname, 'rb') as fin: |
226 fout = sys.stdout.buffer | 226 fout = sys.stdout.buffer |
227 process(fin, fout, opts) | 227 process(fin, fout, opts) |
228 | 228 |
229 if __name__ == '__main__': | 229 if __name__ == '__main__': |
230 if sys.version_info.major < 3: | |
231 print('This script must be run under Python 3.') | |
232 sys.exit(3) | |
230 main() | 233 main() |