Changeset 70566 in vbox
- Timestamp:
- Jan 12, 2018 6:25:48 PM (7 years ago)
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 4 edited
-
common/utils.py (modified) (4 diffs)
-
testboxscript/testboxconnection.py (modified) (3 diffs)
-
testboxscript/testboxtasks.py (modified) (2 diffs)
-
testdriver/reporter.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/common/utils.py
r70518 r70566 104 104 else: 105 105 try: 106 sArch = processOutputChecked(['/usr/bin/isainfo', '-n',]);106 sArch = str(processOutputChecked(['/usr/bin/isainfo', '-n',])); 107 107 except: 108 108 pass; … … 586 586 Wrapper around subprocess.check_output to deal with its absense in older 587 587 python versions. 588 """ 588 Extra keyword: sEncoding='utf-8; for specifying now output is to be decoded. 589 """ 590 sEncoding = dKeywordArgs.get('sEncoding'); 591 if sEncoding is not None: del dKeywordArgs['sEncoding']; 592 else: sEncoding = 'utf-8'; 593 589 594 _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs); 590 595 oProcess = processPopenSafe(stdout=subprocess.PIPE, *aPositionalArgs, **dKeywordArgs); … … 600 605 raise subprocess.CalledProcessError(iExitCode, asArgs); 601 606 602 return s tr(sOutput); # str() make pylint happy.607 return sOutput.decode(sEncoding); 603 608 604 609 g_fOldSudo = None; … … 625 630 if g_fOldSudo is None: 626 631 try: 627 sVersion = processOutputChecked(['sudo', '-V']);632 sVersion = str(processOutputChecked(['sudo', '-V'])); 628 633 except: 629 634 sVersion = '1.7.0'; -
trunk/src/VBox/ValidationKit/testboxscript/testboxconnection.py
r70560 r70566 32 32 # Standard python imports. 33 33 import sys; 34 import urllib35 34 if sys.version_info[0] >= 3: 36 import http.client as httplib; # pylint: disable=import-error,no-name-in-module 37 import urllib.parse as urlparse; # pylint: disable=import-error,no-name-in-module 35 import http.client as httplib; # pylint: disable=import-error,no-name-in-module 36 import urllib.parse as urlparse; # pylint: disable=import-error,no-name-in-module 37 from urllib.parse import urlencode as urllib_urlencode; # pylint: disable=import-error,no-name-in-module 38 38 else: 39 import httplib; # pylint: disable=import-error 40 import urlparse; # pylint: disable=import-error 39 import httplib; # pylint: disable=import-error 40 import urlparse; # pylint: disable=import-error 41 from urllib import urlencode as urllib_urlencode; # pylint: disable=import-error 41 42 42 43 # Validation Kit imports. … … 59 60 # Read the whole response (so we can log it). 60 61 sBody = oResponse.read(); 62 sBody = sBody.decode('utf-8'); 61 63 62 64 # Check the content type. … … 199 201 sServerPath = '/%s/testboxdisp.py' % (self._oParsedUrl.path.strip('/'),); # pylint: disable=E1101 200 202 dParams[constants.tbreq.ALL_PARAM_ACTION] = sAction; 201 sBody = urllib .urlencode(dParams);203 sBody = urllib_urlencode(dParams); 202 204 ##testboxcommons.log2('sServerPath=%s' % (sServerPath,)); 203 205 try: -
trunk/src/VBox/ValidationKit/testboxscript/testboxtasks.py
r70548 r70566 642 642 oFile = open(sPath, "rb"); 643 643 sStr = oFile.read(); 644 sStr = sStr.decode('utf-8'); 644 645 oFile.close(); 645 646 return sStr.strip(); … … 779 780 try: 780 781 oFile = open(sPath, "wb"); 781 oFile.write(sContent );782 oFile.write(sContent.encode('utf-8')); 782 783 oFile.flush(); 783 784 try: os.fsync(oFile.fileno()); -
trunk/src/VBox/ValidationKit/testdriver/reporter.py
r70521 r70566 658 658 659 659 # Prepare the TM connecting. 660 import urlparse;661 import httplib;662 import urllib;663 660 from common import constants; 664 665 self._fnUrlEncode = urllib.urlencode; 666 self._fnUrlParseQs = urlparse.parse_qs; 667 self._oParsedTmUrl = urlparse.urlparse(self.sTestManagerUrl); 661 if sys.version_info[0] >= 3: 662 import urllib; 663 self._fnUrlEncode = urllib.parse.urlencode; # pylint: disable=no-member 664 self._fnUrlParseQs = urllib.parse.parse_qs; # pylint: disable=no-member 665 self._oParsedTmUrl = urllib.parse.urlparse(self.sTestManagerUrl); # pylint: disable=no-member 666 import http.client as httplib; # pylint: disable=no-name-in-module,import-error 667 else: 668 import urllib; 669 self._fnUrlEncode = urllib.urlencode; # pylint: disable=no-member 670 import urlparse; # pylint: disable=import-error 671 self._fnUrlParseQs = urlparse.parse_qs; # pylint: disable=no-member 672 self._oParsedTmUrl = urlparse.urlparse(self.sTestManagerUrl); # pylint: disable=no-member 673 import httplib; # pylint: disable=no-name-in-module,import-error 668 674 669 675 if sys.version_info[0] >= 3 \ … … 697 703 self._sTmServerPath = '/%s/testboxdisp.py?%s' \ 698 704 % ( self._oParsedTmUrl.path.strip('/'), # pylint: disable=E1101 699 urllib.urlencode(dParams), );705 self._fnUrlEncode(dParams), ); 700 706 701 707 def __del__(self):
Note:
See TracChangeset
for help on using the changeset viewer.

