Changeset 5b993e0 for tests/pybin/tools.py
- Timestamp:
- Mar 25, 2019, 12:05:29 PM (4 years ago)
- Branches:
- arm-eh, 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/pybin/tools.py
rd4a60ac r5b993e0 1 from __future__ import print_function2 3 1 import __main__ 4 2 import argparse … … 12 10 import sys 13 11 import time 12 import types 14 13 15 14 from pybin import settings … … 58 57 # Remove 1 or more files silently 59 58 def 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 ) 65 62 66 63 # Create 1 or more directory 67 64 def 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) ) 73 70 74 71 … … 200 197 # Start the walk 201 198 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 ) 203 203 204 204 ################################################################################ … … 268 268 cmd = "%s 2> /dev/null" % column 269 269 proc = Popen(cmd, stdin=PIPE, stderr=None, shell=True) 270 proc.communicate(input= text + "\n")270 proc.communicate(input=bytes(text + "\n", "UTF-8")) 271 271 else: 272 272 print(text)
Note: See TracChangeset
for help on using the changeset viewer.