Skip to content

Commit 096d6df

Browse files
lib: further improvments for if statments (now in gyp: easy_xml.py)
improved if statment for unicode string support specialy for windows Co-authored-by: Christian Clauss <[email protected]>
1 parent 96319bc commit 096d6df

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

gyp/pylib/gyp/easy_xml.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,8 @@ def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, win32=False
122122

123123
default_encoding = locale.getdefaultlocale()[1]
124124
if default_encoding and default_encoding.upper() != encoding.upper():
125-
if sys.platform == "win32":
126-
if (sys.version_info[0] + sys.version_info[1] * 0.1) > 3.7:
127-
xml_string = xml_string.encode(encoding)
128-
else:
129-
xml_string = xml_string.decode("cp1251").encode(encoding)
130-
# for non windows systems
125+
if sys.platform == "win32" and sys.version_info < (3, 7):
126+
xml_string = xml_string.decode("cp1251").encode(encoding)
131127
else:
132128
xml_string = xml_string.encode(encoding)
133129

0 commit comments

Comments
 (0)