VirtualBox

Ignore:
Timestamp:
Jan 10, 2018 3:49:10 PM (7 years ago)
Author:
vboxsync
Message:

ValidationKit: More python 3 adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py

    r70508 r70521  
    3232
    3333# Standard Python imports.
    34 import os
    35 import socket
     34import os;
     35import socket;
     36import sys;
    3637
    3738# Validation Kit imports.
     
    480481                if fErrorOnTimeout:
    481482                    if fIgnoreErrors:
    482                         reporter.log('Timing out after waiting for %u s on "%s" operation %d' \
     483                        reporter.log('Timing out after waiting for %s s on "%s" operation %d' \
    483484                                     % (cMsTimeout / 1000, self.sName, iOperation))
    484485                    else:
    485                         reporter.error('Timing out after waiting for %u s on "%s" operation %d' \
     486                        reporter.error('Timing out after waiting for %s s on "%s" operation %d' \
    486487                                       % (cMsTimeout / 1000, self.sName, iOperation))
    487488                return -1;
     
    15441545                sHostIP = socket.gethostbyname(sHostName)
    15451546                abHostIP = socket.inet_aton(sHostIP)
    1546                 if   ord(abHostIP[0]) == 127 \
    1547                   or (ord(abHostIP[0]) == 169 and ord(abHostIP[1]) == 254) \
    1548                   or (ord(abHostIP[0]) == 192 and ord(abHostIP[1]) == 168 and ord(abHostIP[2]) == 56):
     1547                if sys.version_info[0] < 3:
     1548                    abHostIP = (ord(abHostIP[0]), ord(abHostIP[1]), ord(abHostIP[2]), ord(abHostIP[3]));
     1549                if   abHostIP[0] == 127 \
     1550                  or (abHostIP[0] == 169 and abHostIP[1] == 254) \
     1551                  or (abHostIP[0] == 192 and abHostIP[1] == 168 and abHostIP[2] == 56):
    15491552                    reporter.log('warning: host IP for "%s" is %s, most likely not unique.' % (sHostName, sHostIP))
    15501553            except:
     
    15521555                return False
    15531556            sDefaultMac = '%02X%02X%02X%02X%02X%02X' \
    1554                 % (0x02, ord(abHostIP[0]), ord(abHostIP[1]), ord(abHostIP[2]), ord(abHostIP[3]), iNic)
     1557                % (0x02, abHostIP[0], abHostIP[1], abHostIP[2], abHostIP[3], iNic)
    15551558            sMacAddr = sDefaultMac[0:(12 - cchMacAddr)] + sMacAddr
    15561559
     
    28332836
    28342837        oTxsSession = txsclient.tryOpenTcpSession(cMsTimeout, sHostname, fReversedSetup = fReversed,
    2835                                                   cMsIdleFudge = cMsTimeout / 2);
     2838                                                  cMsIdleFudge = cMsTimeout // 2);
    28362839        if oTxsSession is None:
    28372840            return False;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette