Changeset 71157 in vbox
- Timestamp:
- Feb 28, 2018 3:38:15 PM (7 years ago)
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/common/utils.py
r70710 r71157 6 6 Common Utility Functions. 7 7 """ 8 9 from __future__ import print_function; 8 10 9 11 __copyright__ = \ … … 61 63 xrange = range; # pylint: disable=redefined-builtin,invalid-name 62 64 long = int; # pylint: disable=redefined-builtin,invalid-name 65 66 67 # 68 # Output. 69 # 70 71 def printOut(sString): 72 """ 73 Outputs a string to standard output, dealing with python 2.x encoding stupidity. 74 """ 75 sStreamEncoding = sys.stdout.encoding; 76 if sStreamEncoding == 'UTF-8' or not isinstance(sString, unicode): 77 print(sString); 78 else: 79 print(sString.encode(sStreamEncoding, 'backslashreplace').decode(sStreamEncoding)); 80 81 def printErr(sString): 82 """ 83 Outputs a string to standard error, dealing with python 2.x encoding stupidity. 84 """ 85 sStreamEncoding = sys.stderr.encoding; 86 if sStreamEncoding == 'UTF-8' or not isinstance(sString, unicode): 87 print(sString, file = sys.stderr); 88 else: 89 print(sString.encode(sStreamEncoding, 'backslashreplace').decode(sStreamEncoding), file = sys.stderr); 63 90 64 91 -
trunk/src/VBox/ValidationKit/testmanager/batch/vcs_import.py
r71156 r71157 131 131 sMessage = sMessage[:VcsRevisionData.kcchMax_sMessage - 4] + ' ...'; 132 132 if not self.oConfig.fQuiet: 133 if isinstance(sMessage, unicode) and hasattr(sMessage, 'encode'): 134 sMessage = sMessage.encode(sys.getdefaultencoding(), 'ignore') 135 print(u'sDate=%s iRev=%u sAuthor=%s sMsg[%s]=%s' % (sDate, iRevision, sAuthor, type(sMessage).__name__, sMessage)); 133 utils.printOut(u'sDate=%s iRev=%u sAuthor=%s sMsg[%s]=%s' 134 % (sDate, iRevision, sAuthor, type(sMessage).__name__, sMessage)); 136 135 oData = VcsRevisionData().initFromValues(self.oConfig.sRepository, iRevision, sDate, sAuthor, sMessage); 137 136 oLogic.addVcsRevision(oData);
Note:
See TracChangeset
for help on using the changeset viewer.