diff options
author | Daniel Lange <DLange@git.local> | 2018-04-11 01:26:28 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2018-04-11 01:26:28 +0200 |
commit | 097fb9e4a3460fe1b6b3fc645ef97acb44946141 (patch) | |
tree | 58ba6c6459b926f555a539fab1ec01ff4e93d9ce /scripts/MakeHeader.py | |
parent | 2f3c2439d8d88cf7c1ecef0bcb2b33f747f3ed06 (diff) | |
parent | c60f4cf3c1d91bd786db8e081699f420f44631f3 (diff) | |
download | debian_htop-097fb9e4a3460fe1b6b3fc645ef97acb44946141.tar.gz debian_htop-097fb9e4a3460fe1b6b3fc645ef97acb44946141.tar.bz2 debian_htop-097fb9e4a3460fe1b6b3fc645ef97acb44946141.zip |
Updated version 2.2.0 from 'upstream/2.2.0'
with Debian dir ed195b175f9cd34e0ba2b22dfecc727ab25e1463
Diffstat (limited to 'scripts/MakeHeader.py')
-rwxr-xr-x | scripts/MakeHeader.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/scripts/MakeHeader.py b/scripts/MakeHeader.py index 4841bda..7c48fdd 100755 --- a/scripts/MakeHeader.py +++ b/scripts/MakeHeader.py @@ -1,12 +1,9 @@ #!/usr/bin/env python -import os, sys, string +import os, sys, string, io try: - from cStringIO import StringIO + from StringIO import StringIO except ImportError: - try: - from StringIO import StringIO - except ImportError: - from io import StringIO + from io import StringIO ANY=1 COPY=2 @@ -16,7 +13,7 @@ SKIPONE=4 state = ANY static = 0 -file = open(sys.argv[1]) +file = io.open(sys.argv[1], "r", encoding="utf-8") name = sys.argv[1][:-2] out = StringIO() @@ -94,12 +91,12 @@ out.write( "#endif\n" ) # This prevents a lot of recompilation during development out.seek(0) try: - with open(name + ".h", "r") as orig: + with io.open(name + ".h", "r", encoding="utf-8") as orig: origcontents = orig.readlines() except: origcontents = "" if origcontents != out.readlines(): - with open(name + ".h", "w") as new: + with io.open(name + ".h", "w", encoding="utf-8") as new: print("Writing "+name+".h") new.write(out.getvalue()) out.close() |