Fix setuptools.command.easy_install.extract_wininst_cfg() with Python 2.6 and 2.7.

It was broken since commit 3bbd42903af8, which changed chr(0) (which is '\x00') into bytes([0]).
bytes([0]) is '[0]' in Python 2.6 and 2.7 and b'\x00' in Python 3.
parent c30d4387
......@@ -1413,13 +1413,8 @@ def extract_wininst_cfg(dist_filename):
{'version': '', 'target_version': ''})
try:
part = f.read(cfglen)
# part is in bytes, but we need to read up to the first null
# byte.
if sys.version_info >= (2, 6):
null_byte = bytes([0])
else:
null_byte = chr(0)
config = part.split(null_byte, 1)[0]
# Read up to the first null byte.
config = part.split(b'\0', 1)[0]
# Now the config is in bytes, but for RawConfigParser, it should
# be text, so decode it.
config = config.decode(sys.getfilesystemencoding())
......
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