Fixed some issues related to Python's universal newline support.

Fri, 14 May 2010 12:31:34 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 14 May 2010 12:31:34 +0200
changeset 245
de5c4effc747
parent 243
a1d982e68edf
child 246
121d83ba74d5

Fixed some issues related to Python's universal newline support.

E5XML/XMLWriterBase.py file | annotate | diff | comparison | revisions
PluginManager/PluginManager.py file | annotate | diff | comparison | revisions
Project/CreateDialogCodeDialog.py file | annotate | diff | comparison | revisions
Project/ProjectFormsBrowser.py file | annotate | diff | comparison | revisions
Project/ProjectResourcesBrowser.py file | annotate | diff | comparison | revisions
Project/ProjectTranslationsBrowser.py file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
eric5-api.py file | annotate | diff | comparison | revisions
--- a/E5XML/XMLWriterBase.py	Thu May 13 14:36:46 2010 +0200
+++ b/E5XML/XMLWriterBase.py	Fri May 14 12:31:34 2010 +0200
@@ -7,7 +7,6 @@
 Module implementing a base class for all of eric5s XML writers.
 """
 
-import os
 import pickle
 import base64
 
@@ -50,7 +49,7 @@
         @param newline flag indicating a linebreak
         """
         self.pf.write("%s%s" % (s, 
-            newline and os.linesep or ""))
+            newline and "\n" or ""))
         
     def writeXML(self):
         """
--- a/PluginManager/PluginManager.py	Thu May 13 14:36:46 2010 +0200
+++ b/PluginManager/PluginManager.py	Fri May 14 12:31:34 2010 +0200
@@ -165,11 +165,11 @@
                 os.mkdir(self.pluginDirs["global"], 0o755)
                 fname = os.path.join(self.pluginDirs["global"], "__init__.py")
                 f = open(fname, "w", encoding = "utf-8")
-                f.write('# -*- coding: utf-8 -*-' + os.linesep)
-                f.write(os.linesep)
-                f.write('"""' + os.linesep)
-                f.write('Package containing the global plugins.' + os.linesep)
-                f.write('"""' + os.linesep)
+                f.write('# -*- coding: utf-8 -*-' + "\n")
+                f.write("\n")
+                f.write('"""' + "\n")
+                f.write('Package containing the global plugins.' + "\n")
+                f.write('"""' + "\n")
                 f.close()
             if not os.path.exists(self.pluginDirs["global"]):
                 del self.pluginDirs["global"]
--- a/Project/CreateDialogCodeDialog.py	Thu May 13 14:36:46 2010 +0200
+++ b/Project/CreateDialogCodeDialog.py	Fri May 14 12:31:34 2010 +0200
@@ -339,8 +339,8 @@
                 srcFile = open(self.srcFile, 'r', encoding = "utf-8")
                 sourceImpl = srcFile.readlines()
                 srcFile.close()
-                if not sourceImpl[-1].endswith(os.linesep):
-                    sourceImpl[-1] = "%s%s" % (sourceImpl[-1], os.linesep)
+                if not sourceImpl[-1].endswith("\n"):
+                    sourceImpl[-1] = "%s%s" % (sourceImpl[-1], "\n")
             except IOError as why:
                 QMessageBox.critical(self,
                     self.trUtf8("Code Generation"),
--- a/Project/ProjectFormsBrowser.py	Thu May 13 14:36:46 2010 +0200
+++ b/Project/ProjectFormsBrowser.py	Fri May 14 12:31:34 2010 +0200
@@ -613,7 +613,7 @@
             try:
                 f = open(ofn, "w", encoding = "utf-8")
                 for line in self.buf.splitlines():
-                    f.write(line + os.linesep)
+                    f.write(line + "\n")
                 f.close()
                 if self.compiledFile not in self.project.pdata["SOURCES"]:
                     self.project.appendFile(ofn)
--- a/Project/ProjectResourcesBrowser.py	Thu May 13 14:36:46 2010 +0200
+++ b/Project/ProjectResourcesBrowser.py	Fri May 14 12:31:34 2010 +0200
@@ -507,7 +507,7 @@
             try:
                 f = open(ofn, "w", encoding = "utf-8")
                 for line in self.buf.splitlines():
-                    f.write(line + os.linesep)
+                    f.write(line + "\n")
                 f.close()
                 if self.compiledFile not in self.project.pdata["SOURCES"]:
                     self.project.appendFile(ofn)
--- a/Project/ProjectTranslationsBrowser.py	Thu May 13 14:36:46 2010 +0200
+++ b/Project/ProjectTranslationsBrowser.py	Fri May 14 12:31:34 2010 +0200
@@ -714,15 +714,15 @@
                     last = len(list) - 1
                     if last > 0:
                         pf.write('%s \\%s' % \
-                            (list[0].replace(os.sep, '/'), os.linesep))
+                            (list[0].replace(os.sep, '/'), "\n"))
                         for i in range(1, last):
                             pf.write('\t%s \\%s' % \
-                                (list[i].replace(os.sep, '/'), os.linesep))
+                                (list[i].replace(os.sep, '/'), "\n"))
                         pf.write('\t%s %s%s' % \
-                            (list[last].replace(os.sep, '/'), os.linesep, os.linesep))
+                            (list[last].replace(os.sep, '/'), "\n", "\n"))
                     else:
                         pf.write('%s %s%s' % \
-                            (list[0].replace(os.sep, '/'), os.linesep, os.linesep))
+                            (list[0].replace(os.sep, '/'), "\n", "\n"))
                 
             pf.close()
             self.tmpProject = pfile
--- a/QScintilla/Editor.py	Thu May 13 14:36:46 2010 +0200
+++ b/QScintilla/Editor.py	Fri May 14 12:31:34 2010 +0200
@@ -4635,7 +4635,7 @@
         
         try:
             f = open(fname, "w", encoding = "utf-8")
-            f.write("%s%s" % (name, os.linesep))
+            f.write("%s%s" % (name, "\n"))
             f.write(self.macros[name].save())
             f.close()
         except IOError:
--- a/eric5-api.py	Thu May 13 14:36:46 2010 +0200
+++ b/eric5-api.py	Fri May 14 12:31:34 2010 +0200
@@ -250,7 +250,7 @@
             os.makedirs(outdir)
         try:
             out = open(outputFile, "w", encoding = "utf-8")
-            out.write(os.linesep.join(sorted(apis)))
+            out.write("\n".join(sorted(apis)))
             out.close()
         except IOError as v:
             sys.stderr.write("%s error: %s\n" % (outputFile, v[1]))

eric ide

mercurial