aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/MakeHeader.py
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2018-04-11 01:26:28 +0200
committerDaniel Lange <DLange@git.local>2018-04-11 01:26:28 +0200
commitc60f4cf3c1d91bd786db8e081699f420f44631f3 (patch)
treeb30ce33fd0d49398b52bf9a90b42304a7c32455a /scripts/MakeHeader.py
parent2ee50d030178cede83eb9d0005fbc19f819d30fe (diff)
downloaddebian_htop-c60f4cf3c1d91bd786db8e081699f420f44631f3.tar.gz
debian_htop-c60f4cf3c1d91bd786db8e081699f420f44631f3.tar.bz2
debian_htop-c60f4cf3c1d91bd786db8e081699f420f44631f3.zip
New upstream version 2.2.0
Diffstat (limited to 'scripts/MakeHeader.py')
-rwxr-xr-xscripts/MakeHeader.py15
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()

© 2014-2024 Faster IT GmbH | imprint | privacy policy