install.py

changeset 3939
fc1ea4bbb201
parent 3937
607dd5b0079b
child 3942
a79c9261e7a8
--- a/install.py	Tue Nov 25 19:16:34 2014 +0100
+++ b/install.py	Tue Nov 25 19:29:19 2014 +0100
@@ -27,6 +27,12 @@
 import distutils.sysconfig
 import codecs
 
+if sys.version_info[0] == 2:
+    import sip
+    sip.setapi('QString', 2)
+    sip.setapi('QVariant', 2)
+    sip.setapi('QTextStream', 2)
+
 # Define the globals.
 progName = None
 currDir = os.getcwd()
@@ -263,13 +269,19 @@
     @param dst destination file name (string)
     @param marker marker to be used (string)
     """
-    f = open(src, "r")
+    if sys.version_info[0] == 2:
+        f = codecs.open(src, "r", "utf-8")
+    else:
+        f = open(src, "r")
     text = f.read()
     f.close()
     
     text = text.replace("@MARKER@", marker)
     
-    f = open(dst, "w")
+    if sys.version_info[0] == 2:
+        f = codecs.open(dst, "w", "utf-8")
+    else:
+        f = open(dst, "w")
     f.write(text)
     f.close()
     os.chmod(dst, 0o644)

eric ide

mercurial