VirtualBox

Ignore:
Timestamp:
Jan 11, 2018 8:46:02 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120222
Message:

testboxscript: Python 3 adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testboxscript/testboxupgrade.py

    r69111 r70548  
    9090    for sMember in asMembers:
    9191        if sMember.endswith('/'):
    92             os.makedirs(os.path.join(sUpgradeDir, sMember.replace('/', os.path.sep)), 0775);
     92            os.makedirs(os.path.join(sUpgradeDir, sMember.replace('/', os.path.sep)), 0o775);
    9393        else:
    9494            oZip.extract(sMember, sUpgradeDir);
     
    110110                return False;
    111111            try:
    112                 os.chmod(sFull, 0755);
    113             except Exception, oXcpt:
     112                os.chmod(sFull, 0o755);
     113            except Exception as oXcpt:
    114114                testboxcommons.log('warning chmod error on %s: %s' % (sFull, oXcpt));
    115115    return True;
     
    170170                sFull = os.path.join(g_ksValidationKitDir, sMember);
    171171                if not os.path.isdir(sFull):
    172                     os.makedirs(sFull, 0755);
     172                    os.makedirs(sFull, 0o755);
    173173
    174174    #
     
    189189                try:
    190190                    os.rename(sDst, sDstRm);
    191                 except Exception, oXcpt:
     191                except Exception as oXcpt:
    192192                    testboxcommons.log('Error: failed to rename (old) "%s" to "%s": %s' % (sDst, sDstRm, oXcpt));
    193193                    try:
    194194                        shutil.copy(sDst, sDstRm);
    195                     except Exception, oXcpt:
     195                    except Exception as oXcpt:
    196196                        testboxcommons.log('Error: failed to copy (old) "%s" to "%s": %s' % (sDst, sDstRm, oXcpt));
    197197                        break;
    198198                    try:
    199199                        os.unlink(sDst);
    200                     except Exception, oXcpt:
     200                    except Exception as oXcpt:
    201201                        testboxcommons.log('Error: failed to unlink (old) "%s": %s' % (sDst, oXcpt));
    202202                        break;
     
    206206            try:
    207207                os.rename(sSrc, sDst);
    208             except Exception, oXcpt:
     208            except Exception as oXcpt:
    209209                testboxcommons.log('Warning: failed to rename (new) "%s" to "%s": %s' % (sSrc, sDst, oXcpt));
    210210                try:
     
    259259                try:
    260260                    os.rmdir(sFull);
    261                 except Exception, oXcpt:
     261                except Exception as oXcpt:
    262262                    testboxcommons.log('Warning: failed to rmdir obsolete dir "%s": %s' % (sFull, oXcpt));
    263263
     
    268268                try:
    269269                    os.unlink(sFull);
    270                 except Exception, oXcpt:
     270                except Exception as oXcpt:
    271271                    testboxcommons.log('Warning: failed to unlink obsolete file "%s": %s' % (sFull, oXcpt));
    272272    return True;
Note: See TracChangeset for help on using the changeset viewer.

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