Ignore:
Timestamp:
Mar 25, 2019, 12:05:29 PM (5 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d3c1c6a
Parents:
d4a60ac
Message:

Updated test scripts to use python3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/pybin/tools.py

    rd4a60ac r5b993e0  
    1 from __future__ import print_function
    2 
    31import __main__
    42import argparse
     
    1210import sys
    1311import time
     12import types
    1413
    1514from pybin import settings
     
    5857# Remove 1 or more files silently
    5958def rm( files ):
    60         if isinstance( files, basestring ):
    61                 sh("rm -f %s > /dev/null 2>&1" % files )
    62         else:
    63                 for file in files:
    64                         sh("rm -f %s > /dev/null 2>&1" % file )
     59        if isinstance(files, str ): files = [ files ]
     60        for file in files:
     61                sh("rm -f %s > /dev/null 2>&1" % file )
    6562
    6663# Create 1 or more directory
    6764def mkdir( files ):
    68         if isinstance( files, basestring ):
    69                 sh("mkdir -p %s" % os.path.dirname(files) )
    70         else:
    71                 for file in files:
    72                         sh("mkdir -p %s" % os.path.dirname(file) )
     65        if isinstance(files, str ): files = [ files ]
     66        for file in files:
     67                p = os.path.normpath( file )
     68                d = os.path.dirname ( p )
     69                sh( "mkdir -p {}".format(d) )
    7370
    7471
     
    200197        # Start the walk
    201198        dname = settings.SRCDIR
    202         os.path.walk(dname, step, '')
     199        for dirname, _, names in os.walk(dname):
     200                for name in names:
     201                        path = os.path.join(dirname, name)
     202                        op( path )
    203203
    204204################################################################################
     
    268268                cmd = "%s 2> /dev/null" % column
    269269                proc = Popen(cmd, stdin=PIPE, stderr=None, shell=True)
    270                 proc.communicate(input=text + "\n")
     270                proc.communicate(input=bytes(text + "\n", "UTF-8"))
    271271        else:
    272272                print(text)
Note: See TracChangeset for help on using the changeset viewer.