Skip to content

Commit

Permalink
lib: further improvments for if statments (now in gyp: easy_xml.py)
Browse files Browse the repository at this point in the history
improved if statment for unicode string support specialy for windows

Co-authored-by: Christian Clauss <cclauss@me.com>
  • Loading branch information
owl-from-hogvarts and cclauss committed Nov 6, 2020
1 parent 96319bc commit 096d6df
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions gyp/pylib/gyp/easy_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,8 @@ def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, win32=False

default_encoding = locale.getdefaultlocale()[1]
if default_encoding and default_encoding.upper() != encoding.upper():
if sys.platform == "win32":
if (sys.version_info[0] + sys.version_info[1] * 0.1) > 3.7:
xml_string = xml_string.encode(encoding)
else:
xml_string = xml_string.decode("cp1251").encode(encoding)
# for non windows systems
if sys.platform == "win32" and sys.version_info < (3, 7):
xml_string = xml_string.decode("cp1251").encode(encoding)
else:
xml_string = xml_string.encode(encoding)

Expand Down

0 comments on commit 096d6df

Please sign in to comment.