Patchwork D6341: contrib: have byteify-strings explode if run in Python 2

login
register
mail settings
Submitter phabricator
Date May 5, 2019, 1:35 a.m.
Message ID <36eee737d309b7b6e8bc1c4df3b9bce8@localhost.localdomain>
Download mbox | patch
Permalink /patch/39949/
State Not Applicable
Headers show

Comments

phabricator - May 5, 2019, 1:35 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG970aaf38c3fc: contrib: have byteify-strings explode if run in Python 2 (authored by durin42, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6341?vs=15004&id=15007#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6341?vs=15004&id=15007

REVISION DETAIL
  https://phab.mercurial-scm.org/D6341

AFFECTED FILES
  contrib/byteify-strings.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/byteify-strings.py b/contrib/byteify-strings.py
--- a/contrib/byteify-strings.py
+++ b/contrib/byteify-strings.py
@@ -7,7 +7,7 @@ 
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 
 import argparse
 import contextlib
@@ -227,4 +227,7 @@ 
                 process(fin, fout, opts)
 
 if __name__ == '__main__':
+    if sys.version_info.major < 3:
+        print('This script must be run under Python 3.')
+        sys.exit(3)
     main()