Commit 595231dd authored by Yuchen Xie's avatar Yuchen Xie Committed by Jie Luo

Update minimal Python version to 2.7 (#4207)

parent d65d5821
...@@ -30,7 +30,7 @@ join the Protocol Buffers discussion list and let us know! ...@@ -30,7 +30,7 @@ join the Protocol Buffers discussion list and let us know!
Installation Installation
============ ============
1) Make sure you have Python 2.6 or newer. If in doubt, run: 1) Make sure you have Python 2.7 or newer. If in doubt, run:
$ python -V $ python -V
......
...@@ -791,9 +791,6 @@ class JsonFormatTest(JsonFormatBase): ...@@ -791,9 +791,6 @@ class JsonFormatTest(JsonFormatBase):
json_format.Parse(text, parsed_message, ignore_unknown_fields=True) json_format.Parse(text, parsed_message, ignore_unknown_fields=True)
def testDuplicateField(self): def testDuplicateField(self):
# Duplicate key check is not supported for python2.6
if sys.version_info < (2, 7):
return
self.CheckError('{"int32Value": 1,\n"int32Value":2}', self.CheckError('{"int32Value": 1,\n"int32Value":2}',
'Failed to load JSON: duplicate key int32Value.') 'Failed to load JSON: duplicate key int32Value.')
......
...@@ -396,11 +396,7 @@ def Parse(text, message, ignore_unknown_fields=False): ...@@ -396,11 +396,7 @@ def Parse(text, message, ignore_unknown_fields=False):
""" """
if not isinstance(text, six.text_type): text = text.decode('utf-8') if not isinstance(text, six.text_type): text = text.decode('utf-8')
try: try:
if sys.version_info < (2, 7): js = json.loads(text, object_pairs_hook=_DuplicateChecker)
# object_pair_hook is not supported before python2.7
js = json.loads(text)
else:
js = json.loads(text, object_pairs_hook=_DuplicateChecker)
except ValueError as e: except ValueError as e:
raise ParseError('Failed to load JSON: {0}.'.format(str(e))) raise ParseError('Failed to load JSON: {0}.'.format(str(e)))
return ParseDict(js, message, ignore_unknown_fields) return ParseDict(js, message, ignore_unknown_fields)
......
...@@ -149,10 +149,9 @@ class build_py(_build_py): ...@@ -149,10 +149,9 @@ class build_py(_build_py):
class test_conformance(_build_py): class test_conformance(_build_py):
target = 'test_python' target = 'test_python'
def run(self): def run(self):
if sys.version_info >= (2, 7): # Python 2.6 dodges these extra failures.
# Python 2.6 dodges these extra failures. os.environ["CONFORMANCE_PYTHON_EXTRA_FAILURES"] = (
os.environ["CONFORMANCE_PYTHON_EXTRA_FAILURES"] = ( "--failure_list failure_list_python-post26.txt")
"--failure_list failure_list_python-post26.txt")
cmd = 'cd ../conformance && make %s' % (test_conformance.target) cmd = 'cd ../conformance && make %s' % (test_conformance.target)
status = subprocess.check_call(cmd, shell=True) status = subprocess.check_call(cmd, shell=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment