389 if self.pdata["MIXEDLANGUAGE"][0]: |
389 if self.pdata["MIXEDLANGUAGE"][0]: |
390 sourceKey = "Mixed" |
390 sourceKey = "Mixed" |
391 else: |
391 else: |
392 sourceKey = self.pdata["PROGLANGUAGE"][0] |
392 sourceKey = self.pdata["PROGLANGUAGE"][0] |
393 for ext in self.sourceExtensions[sourceKey]: |
393 for ext in self.sourceExtensions[sourceKey]: |
394 self.pdata["FILETYPES"]["*%s" % ext] = "SOURCES" |
394 self.pdata["FILETYPES"]["*{0}".format(ext)] = "SOURCES" |
395 self.pdata["FILETYPES"]["*.idl"] = "INTERFACES" |
395 self.pdata["FILETYPES"]["*.idl"] = "INTERFACES" |
396 if self.pdata["PROJECTTYPE"][0] in ["Qt4", "E4Plugin", "PySide"]: |
396 if self.pdata["PROJECTTYPE"][0] in ["Qt4", "E4Plugin", "PySide"]: |
397 self.pdata["FILETYPES"]["*.ui"] = "FORMS" |
397 self.pdata["FILETYPES"]["*.ui"] = "FORMS" |
398 self.pdata["FILETYPES"]["*.ui.h"] = "FORMS" |
398 self.pdata["FILETYPES"]["*.ui.h"] = "FORMS" |
399 if self.pdata["PROJECTTYPE"][0] in ["Qt4", "Qt4C", "E4Plugin", |
399 if self.pdata["PROJECTTYPE"][0] in ["Qt4", "Qt4C", "E4Plugin", |
796 if self.pfile is None: |
796 if self.pfile is None: |
797 return |
797 return |
798 |
798 |
799 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
799 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
800 |
800 |
801 fn = os.path.join(self.getProjectManagementDir(), '%s.e4q' % fn) |
801 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4q'.format(fn)) |
802 if os.path.exists(fn): |
802 if os.path.exists(fn): |
803 try: |
803 try: |
804 f = open(fn, "r", encoding = "utf-8") |
804 f = open(fn, "r", encoding = "utf-8") |
805 |
805 |
806 parser = make_parser(True) |
806 parser = make_parser(True) |
839 if self.pfile is None: |
839 if self.pfile is None: |
840 return |
840 return |
841 |
841 |
842 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
842 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
843 |
843 |
844 fn = os.path.join(self.getProjectManagementDir(), '%s.e4q' % fn) |
844 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4q'.format(fn)) |
845 |
845 |
846 try: |
846 try: |
847 f = open(fn, "w", encoding = "utf-8") |
847 f = open(fn, "w", encoding = "utf-8") |
848 |
848 |
849 UserProjectWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
849 UserProjectWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
873 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
873 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
874 |
874 |
875 try: |
875 try: |
876 if ext.lower() in [".e4pz"]: |
876 if ext.lower() in [".e4pz"]: |
877 fn = os.path.join(self.getProjectManagementDir(), |
877 fn = os.path.join(self.getProjectManagementDir(), |
878 '%s%s.e4sz' % (fn, indicator)) |
878 '{0}{1}.e4sz'.format(fn, indicator)) |
879 try: |
879 try: |
880 import gzip |
880 import gzip |
881 except ImportError: |
881 except ImportError: |
882 if not quiet: |
882 if not quiet: |
883 QMessageBox.critical(None, |
883 QMessageBox.critical(None, |
888 g = gzip.open(fn, "rb") |
888 g = gzip.open(fn, "rb") |
889 f = io.StringIO(g.read().decode("utf-8")) |
889 f = io.StringIO(g.read().decode("utf-8")) |
890 g.close() |
890 g.close() |
891 else: |
891 else: |
892 fn = os.path.join(self.getProjectManagementDir(), |
892 fn = os.path.join(self.getProjectManagementDir(), |
893 '%s%s.e4s' % (fn, indicator)) |
893 '{0}{1}.e4s'.format(fn, indicator)) |
894 f = open(fn, "r", encoding = "utf-8") |
894 f = open(fn, "r", encoding = "utf-8") |
895 line = f.readline() |
895 line = f.readline() |
896 dtdLine = f.readline() |
896 dtdLine = f.readline() |
897 f.close() |
897 f.close() |
898 except EnvironmentError: |
898 except EnvironmentError: |
1017 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1017 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1018 |
1018 |
1019 try: |
1019 try: |
1020 if ext.lower() == ".e4pz": |
1020 if ext.lower() == ".e4pz": |
1021 fn = os.path.join(self.getProjectManagementDir(), |
1021 fn = os.path.join(self.getProjectManagementDir(), |
1022 '%s%s.e4sz' % (fn, indicator)) |
1022 '{0}{1}.e4sz'.format(fn, indicator)) |
1023 try: |
1023 try: |
1024 import gzip |
1024 import gzip |
1025 except ImportError: |
1025 except ImportError: |
1026 if not quiet: |
1026 if not quiet: |
1027 QMessageBox.critical(None, |
1027 QMessageBox.critical(None, |
1030 """ supported. The compression library is missing.""")) |
1030 """ supported. The compression library is missing.""")) |
1031 return |
1031 return |
1032 f = io.StringIO() |
1032 f = io.StringIO() |
1033 else: |
1033 else: |
1034 fn = os.path.join(self.getProjectManagementDir(), |
1034 fn = os.path.join(self.getProjectManagementDir(), |
1035 '%s%s.e4s' % (fn, indicator)) |
1035 '{0}{1}.e4s'.format(fn, indicator)) |
1036 f = open(fn, "w", encoding = "utf-8") |
1036 f = open(fn, "w", encoding = "utf-8") |
1037 |
1037 |
1038 SessionWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
1038 SessionWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
1039 |
1039 |
1040 if fn.lower().endswith("e4sz"): |
1040 if fn.lower().endswith("e4sz"): |
1061 self.trUtf8("Please save the project first.")) |
1061 self.trUtf8("Please save the project first.")) |
1062 return |
1062 return |
1063 |
1063 |
1064 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1064 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1065 |
1065 |
1066 for fn in [os.path.join(self.getProjectManagementDir(), "%s.e4sz" % fname), |
1066 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4sz".format(fname)), |
1067 os.path.join(self.getProjectManagementDir(), "%s.e4s" % fname)]: |
1067 os.path.join(self.getProjectManagementDir(), "{0}.e4s".format(fname))]: |
1068 if os.path.exists(fn): |
1068 if os.path.exists(fn): |
1069 try: |
1069 try: |
1070 os.remove(fn) |
1070 os.remove(fn) |
1071 except OSError: |
1071 except OSError: |
1072 QMessageBox.critical(None, |
1072 QMessageBox.critical(None, |
1086 |
1086 |
1087 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1087 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1088 |
1088 |
1089 try: |
1089 try: |
1090 if ext.lower() in [".e4pz"]: |
1090 if ext.lower() in [".e4pz"]: |
1091 fn = os.path.join(self.getProjectManagementDir(), '%s.e4tz' % fn) |
1091 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4tz'.format(fn)) |
1092 if not os.path.exists(fn): |
1092 if not os.path.exists(fn): |
1093 return |
1093 return |
1094 try: |
1094 try: |
1095 import gzip |
1095 import gzip |
1096 except ImportError: |
1096 except ImportError: |
1101 return |
1101 return |
1102 g = gzip.open(fn, "rb") |
1102 g = gzip.open(fn, "rb") |
1103 f = io.StringIO(g.read().decode("utf-8")) |
1103 f = io.StringIO(g.read().decode("utf-8")) |
1104 g.close() |
1104 g.close() |
1105 else: |
1105 else: |
1106 fn = os.path.join(self.getProjectManagementDir(), '%s.e4t' % fn) |
1106 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4t'.format(fn)) |
1107 if not os.path.exists(fn): |
1107 if not os.path.exists(fn): |
1108 return |
1108 return |
1109 f = open(fn, "r", encoding = "utf-8") |
1109 f = open(fn, "r", encoding = "utf-8") |
1110 line = f.readline() |
1110 line = f.readline() |
1111 dtdLine = f.readline() |
1111 dtdLine = f.readline() |
1192 |
1192 |
1193 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1193 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1194 |
1194 |
1195 try: |
1195 try: |
1196 if ext.lower() == ".e4pz": |
1196 if ext.lower() == ".e4pz": |
1197 fn = os.path.join(self.getProjectManagementDir(), '%s.e4tz' % fn) |
1197 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4tz'.format(fn)) |
1198 try: |
1198 try: |
1199 import gzip |
1199 import gzip |
1200 except ImportError: |
1200 except ImportError: |
1201 QMessageBox.critical(None, |
1201 QMessageBox.critical(None, |
1202 self.trUtf8("Save tasks"), |
1202 self.trUtf8("Save tasks"), |
1203 self.trUtf8("""Compressed tasks files not supported.""" |
1203 self.trUtf8("""Compressed tasks files not supported.""" |
1204 """ The compression library is missing.""")) |
1204 """ The compression library is missing.""")) |
1205 return |
1205 return |
1206 f = io.StringIO() |
1206 f = io.StringIO() |
1207 else: |
1207 else: |
1208 fn = os.path.join(self.getProjectManagementDir(), '%s.e4t' % fn) |
1208 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4t'.format(fn)) |
1209 f = open(fn, "w", encoding = "utf-8") |
1209 f = open(fn, "w", encoding = "utf-8") |
1210 |
1210 |
1211 TasksWriter(f, True, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
1211 TasksWriter(f, True, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
1212 |
1212 |
1213 if fn.lower().endswith("e4tz"): |
1213 if fn.lower().endswith("e4tz"): |
1238 |
1238 |
1239 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1239 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1240 |
1240 |
1241 try: |
1241 try: |
1242 if ext.lower() in [".e4pz"]: |
1242 if ext.lower() in [".e4pz"]: |
1243 fn = os.path.join(self.getProjectManagementDir(), '%s.e4dz' % fn) |
1243 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4dz'.format(fn)) |
1244 try: |
1244 try: |
1245 import gzip |
1245 import gzip |
1246 except ImportError: |
1246 except ImportError: |
1247 if not quiet: |
1247 if not quiet: |
1248 QMessageBox.critical(None, |
1248 QMessageBox.critical(None, |
1253 return |
1253 return |
1254 g = gzip.open(fn, "rb") |
1254 g = gzip.open(fn, "rb") |
1255 f = io.StringIO(g.read().decode("utf-8")) |
1255 f = io.StringIO(g.read().decode("utf-8")) |
1256 g.close() |
1256 g.close() |
1257 else: |
1257 else: |
1258 fn = os.path.join(self.getProjectManagementDir(), '%s.e4d' % fn) |
1258 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) |
1259 f = open(fn, "r", encoding = "utf-8") |
1259 f = open(fn, "r", encoding = "utf-8") |
1260 line = f.readline() |
1260 line = f.readline() |
1261 dtdLine = f.readline() |
1261 dtdLine = f.readline() |
1262 f.close() |
1262 f.close() |
1263 except EnvironmentError: |
1263 except EnvironmentError: |
1361 |
1361 |
1362 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1362 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1363 |
1363 |
1364 try: |
1364 try: |
1365 if ext.lower() == ".e4pz": |
1365 if ext.lower() == ".e4pz": |
1366 fn = os.path.join(self.getProjectManagementDir(), '%s.e4dz' % fn) |
1366 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4dz'.format(fn)) |
1367 try: |
1367 try: |
1368 import gzip |
1368 import gzip |
1369 except ImportError: |
1369 except ImportError: |
1370 if not quiet: |
1370 if not quiet: |
1371 QMessageBox.critical(None, |
1371 QMessageBox.critical(None, |
1374 """ not supported. The compression library is""" |
1374 """ not supported. The compression library is""" |
1375 """ missing.""")) |
1375 """ missing.""")) |
1376 return |
1376 return |
1377 f = io.StringIO() |
1377 f = io.StringIO() |
1378 else: |
1378 else: |
1379 fn = os.path.join(self.getProjectManagementDir(), '%s.e4d' % fn) |
1379 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) |
1380 f = open(fn, "w", encoding = "utf-8") |
1380 f = open(fn, "w", encoding = "utf-8") |
1381 |
1381 |
1382 DebuggerPropertiesWriter(f, os.path.splitext(os.path.basename(fn))[0])\ |
1382 DebuggerPropertiesWriter(f, os.path.splitext(os.path.basename(fn))[0])\ |
1383 .writeXML() |
1383 .writeXML() |
1384 |
1384 |
1407 self.trUtf8("Please save the project first.")) |
1407 self.trUtf8("Please save the project first.")) |
1408 return |
1408 return |
1409 |
1409 |
1410 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1410 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1411 |
1411 |
1412 for fn in [os.path.join(self.getProjectManagementDir(), "%s.e4dz" % fname), |
1412 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4dz".format(fname)), |
1413 os.path.join(self.getProjectManagementDir(), "%s.e4d" % fname)]: |
1413 os.path.join(self.getProjectManagementDir(), "{0}.e4d".format(fname))]: |
1414 if os.path.exists(fn): |
1414 if os.path.exists(fn): |
1415 try: |
1415 try: |
1416 os.remove(fn) |
1416 os.remove(fn) |
1417 except OSError: |
1417 except OSError: |
1418 QMessageBox.critical(None, |
1418 QMessageBox.critical(None, |
1776 elif patterntype == "__IGNORE__": |
1776 elif patterntype == "__IGNORE__": |
1777 ignorePatterns.append(pattern) |
1777 ignorePatterns.append(pattern) |
1778 |
1778 |
1779 files = [] |
1779 files = [] |
1780 for pattern in patterns: |
1780 for pattern in patterns: |
1781 sstring = "%s%s%s" % (source, os.sep, pattern) |
1781 sstring = "{0}{1}{2}".format(source, os.sep, pattern) |
1782 files.extend(glob.glob(sstring)) |
1782 files.extend(glob.glob(sstring)) |
1783 |
1783 |
1784 if len(files) == 0: |
1784 if len(files) == 0: |
1785 if not quiet: |
1785 if not quiet: |
1786 QMessageBox.information(None, |
1786 QMessageBox.information(None, |
2187 """ |
2187 """ |
2188 try: |
2188 try: |
2189 os.remove(os.path.join(self.ppath, fn)) |
2189 os.remove(os.path.join(self.ppath, fn)) |
2190 dummy, ext = os.path.splitext(fn) |
2190 dummy, ext = os.path.splitext(fn) |
2191 if ext == '.ui': |
2191 if ext == '.ui': |
2192 fn2 = os.path.join(self.ppath, '%s.h' % fn) |
2192 fn2 = os.path.join(self.ppath, '{0}.h'.format(fn)) |
2193 if os.path.isfile(fn2): |
2193 if os.path.isfile(fn2): |
2194 os.remove(fn2) |
2194 os.remove(fn2) |
2195 except EnvironmentError: |
2195 except EnvironmentError: |
2196 QMessageBox.critical(None, |
2196 QMessageBox.critical(None, |
2197 self.trUtf8("Delete file"), |
2197 self.trUtf8("Delete file"), |
2521 # the first entry determines the mainscript name |
2521 # the first entry determines the mainscript name |
2522 mainscriptname = os.path.splitext(mainscript)[0] or \ |
2522 mainscriptname = os.path.splitext(mainscript)[0] or \ |
2523 os.path.basename(tslist[0]).split('_')[0] |
2523 os.path.basename(tslist[0]).split('_')[0] |
2524 self.pdata["TRANSLATIONPATTERN"] = \ |
2524 self.pdata["TRANSLATIONPATTERN"] = \ |
2525 [os.path.join(os.path.dirname(tslist[0]), |
2525 [os.path.join(os.path.dirname(tslist[0]), |
2526 "%s_%%language%%%s" % (os.path.basename(tslist[0]).split('_')[0], |
2526 "{0}_%language%{1}".format(os.path.basename(tslist[0]).split('_')[0], |
2527 os.path.splitext(tslist[0])[1]))] |
2527 os.path.splitext(tslist[0])[1]))] |
2528 else: |
2528 else: |
2529 pattern, ok = QInputDialog.getText(\ |
2529 pattern, ok = QInputDialog.getText(\ |
2530 None, |
2530 None, |
2531 self.trUtf8("Translation Pattern"), |
2531 self.trUtf8("Translation Pattern"), |
2543 self.pdata["TRANSLATIONS"].append(ts) |
2543 self.pdata["TRANSLATIONS"].append(ts) |
2544 self.emit(SIGNAL('projectLanguageAdded'), ts) |
2544 self.emit(SIGNAL('projectLanguageAdded'), ts) |
2545 if len(self.pdata["MAINSCRIPT"]) == 0 or \ |
2545 if len(self.pdata["MAINSCRIPT"]) == 0 or \ |
2546 len(self.pdata["MAINSCRIPT"][0]) == 0: |
2546 len(self.pdata["MAINSCRIPT"][0]) == 0: |
2547 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: |
2547 if self.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: |
2548 self.pdata["MAINSCRIPT"] = ['%s.py' % mainscriptname] |
2548 self.pdata["MAINSCRIPT"] = ['{0}.py'.format(mainscriptname)] |
2549 elif self.pdata["PROGLANGUAGE"][0] == "Ruby": |
2549 elif self.pdata["PROGLANGUAGE"][0] == "Ruby": |
2550 self.pdata["MAINSCRIPT"] = ['%s.rb' % mainscriptname] |
2550 self.pdata["MAINSCRIPT"] = ['{0}.rb'.format(mainscriptname)] |
2551 if self.pdata["TRANSLATIONSBINPATH"]: |
2551 if self.pdata["TRANSLATIONSBINPATH"]: |
2552 tpd = os.path.join(self.ppath, |
2552 tpd = os.path.join(self.ppath, |
2553 self.pdata["TRANSLATIONSBINPATH"][0]) |
2553 self.pdata["TRANSLATIONSBINPATH"][0]) |
2554 pattern = os.path.splitext( |
2554 pattern = os.path.splitext( |
2555 os.path.basename(self.pdata["TRANSLATIONPATTERN"][0])) |
2555 os.path.basename(self.pdata["TRANSLATIONPATTERN"][0])) |
3900 self.recentMenu.clear() |
3900 self.recentMenu.clear() |
3901 |
3901 |
3902 idx = 1 |
3902 idx = 1 |
3903 for rp in self.recent: |
3903 for rp in self.recent: |
3904 if idx < 10: |
3904 if idx < 10: |
3905 formatStr = '&%d. %s' |
3905 formatStr = '&{0:d}. {1}' |
3906 else: |
3906 else: |
3907 formatStr = '%d. %s' |
3907 formatStr = '{0:d}. {1}' |
3908 act = self.recentMenu.addAction(\ |
3908 act = self.recentMenu.addAction(\ |
3909 formatStr % (idx, |
3909 formatStr.format(idx, |
3910 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) |
3910 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) |
3911 act.setData(rp) |
3911 act.setData(rp) |
3912 act.setEnabled(QFileInfo(rp).exists()) |
3912 act.setEnabled(QFileInfo(rp).exists()) |
3913 idx += 1 |
3913 idx += 1 |
3914 |
3914 |
4263 basename = os.path.splitext(fn)[0] |
4263 basename = os.path.splitext(fn)[0] |
4264 tbasename = os.path.splitext(tfn)[0] |
4264 tbasename = os.path.splitext(tfn)[0] |
4265 |
4265 |
4266 # determine name of coverage file to be used |
4266 # determine name of coverage file to be used |
4267 files = [] |
4267 files = [] |
4268 f = "%s.coverage" % basename |
4268 f = "{0}.coverage".format(basename) |
4269 tf = "%s.coverage" % tbasename |
4269 tf = "{0}.coverage".format(tbasename) |
4270 if os.path.isfile(f): |
4270 if os.path.isfile(f): |
4271 files.append(f) |
4271 files.append(f) |
4272 if os.path.isfile(tf): |
4272 if os.path.isfile(tf): |
4273 files.append(tf) |
4273 files.append(tf) |
4274 |
4274 |
4309 basename = os.path.splitext(fn)[0] |
4309 basename = os.path.splitext(fn)[0] |
4310 tbasename = os.path.splitext(tfn)[0] |
4310 tbasename = os.path.splitext(tfn)[0] |
4311 |
4311 |
4312 # determine name of profile file to be used |
4312 # determine name of profile file to be used |
4313 files = [] |
4313 files = [] |
4314 f = "%s.profile" % basename |
4314 f = "{0}.profile".format(basename) |
4315 tf = "%s.profile" % tbasename |
4315 tf = "{0}.profile".format(tbasename) |
4316 if os.path.isfile(f): |
4316 if os.path.isfile(f): |
4317 files.append(f) |
4317 files.append(f) |
4318 if os.path.isfile(tf): |
4318 if os.path.isfile(tf): |
4319 files.append(tf) |
4319 files.append(tf) |
4320 |
4320 |
4345 if fn is not None: |
4345 if fn is not None: |
4346 tfn = Utilities.getTestFileName(fn) |
4346 tfn = Utilities.getTestFileName(fn) |
4347 basename = os.path.splitext(fn)[0] |
4347 basename = os.path.splitext(fn)[0] |
4348 tbasename = os.path.splitext(tfn)[0] |
4348 tbasename = os.path.splitext(tfn)[0] |
4349 self.codeProfileAct.setEnabled(\ |
4349 self.codeProfileAct.setEnabled(\ |
4350 os.path.isfile("%s.profile" % basename) or \ |
4350 os.path.isfile("{0}.profile".format(basename)) or \ |
4351 os.path.isfile("%s.profile" % tbasename)) |
4351 os.path.isfile("{0}.profile".format(tbasename))) |
4352 self.codeCoverageAct.setEnabled(\ |
4352 self.codeCoverageAct.setEnabled(\ |
4353 self.pdata["PROGLANGUAGE"][0] == "Python3" and \ |
4353 self.pdata["PROGLANGUAGE"][0] == "Python3" and \ |
4354 (os.path.isfile("%s.coverage" % basename) or \ |
4354 (os.path.isfile("{0}.coverage".format(basename)) or \ |
4355 os.path.isfile("%s.coverage" % tbasename))) |
4355 os.path.isfile("{0}.coverage".format(tbasename)))) |
4356 else: |
4356 else: |
4357 self.codeProfileAct.setEnabled(False) |
4357 self.codeProfileAct.setEnabled(False) |
4358 self.codeCoverageAct.setEnabled(False) |
4358 self.codeCoverageAct.setEnabled(False) |
4359 |
4359 |
4360 self.emit(SIGNAL("showMenu"), "Show", self.showMenu) |
4360 self.emit(SIGNAL("showMenu"), "Show", self.showMenu) |
4627 """ |
4627 """ |
4628 if path == "" or path == "/" or path == "\\": |
4628 if path == "" or path == "/" or path == "\\": |
4629 return |
4629 return |
4630 |
4630 |
4631 if not path.endswith("/") and not path.endswith("\\"): |
4631 if not path.endswith("/") and not path.endswith("\\"): |
4632 path = "%s/" % path |
4632 path = "{0}/".format(path) |
4633 |
4633 |
4634 if not path in zipFile.namelist(): |
4634 if not path in zipFile.namelist(): |
4635 self.__createZipDirEntries(os.path.split(path[:-1])[0], zipFile) |
4635 self.__createZipDirEntries(os.path.split(path[:-1])[0], zipFile) |
4636 zipFile.writestr(path, b"") |
4636 zipFile.writestr(path, b"") |
4637 |
4637 |
4663 while lineno < len(sourcelines): |
4663 while lineno < len(sourcelines): |
4664 if sourcelines[lineno].startswith("version = "): |
4664 if sourcelines[lineno].startswith("version = "): |
4665 # found the line to modify |
4665 # found the line to modify |
4666 datestr = time.strftime("%Y%m%d") |
4666 datestr = time.strftime("%Y%m%d") |
4667 lineend = sourcelines[lineno].replace(sourcelines[lineno].rstrip(), "") |
4667 lineend = sourcelines[lineno].replace(sourcelines[lineno].rstrip(), "") |
4668 sversion = "%s-snapshot-%s" % \ |
4668 sversion = "{0}-snapshot-{1}".format( |
4669 (sourcelines[lineno].replace("version = ", "").strip()[1:-1], |
4669 sourcelines[lineno].replace("version = ", "").strip()[1:-1], |
4670 datestr) |
4670 datestr) |
4671 sourcelines[lineno] = '%s + "-snapshot-%s"%s' % \ |
4671 sourcelines[lineno] = '{0} + "-snapshot-{1}"{2}'.format( |
4672 (sourcelines[lineno].rstrip(), datestr, lineend) |
4672 sourcelines[lineno].rstrip(), datestr, lineend) |
4673 break |
4673 break |
4674 |
4674 |
4675 lineno += 1 |
4675 lineno += 1 |
4676 |
4676 |
4677 source = Utilities.encode("".join(sourcelines), encoding)[0] |
4677 source = Utilities.encode("".join(sourcelines), encoding)[0] |