def go(boost_root): OUTPUT = "src/third_party/boost" if os.path.exists(OUTPUT): shutil.rmtree(OUTPUT) cmd = ["bcp", "--scan", "--boost=%s" % boost_root] src = utils.getAllSourceFiles() cmd += src cmd.append(OUTPUT) if not os.path.exists(OUTPUT): os.makedirs(OUTPUT) res = utils.execsys(cmd) out = open(OUTPUT + "/bcp-out.txt", 'w') out.write(res[0]) out.close() out = open(OUTPUT + "/notes.txt", 'w') out.write("command: " + " ".join(cmd)) out.close() print(res[1])
def go( boost_root ): OUTPUT = "src/third_party/boost" if os.path.exists( OUTPUT ): shutil.rmtree( OUTPUT ) cmd = [ "bcp" , "--scan" , "--boost=%s" % boost_root ] src = utils.getAllSourceFiles() cmd += src cmd.append( OUTPUT ) if not os.path.exists( OUTPUT ): os.makedirs( OUTPUT ) res = utils.execsys( cmd ) out = open( OUTPUT + "/bcp-out.txt" , 'w' ) out.write( res[0] ) out.close() out = open( OUTPUT + "/notes.txt" , 'w' ) out.write( "command: " + " ".join( cmd ) ) out.close() print( res[1] )
def killprocs( signal="" ): cwd = os.getcwd(); if cwd.find("buildscripts" ) > 0 : cwd = cwd.partition( "buildscripts" )[0] killed = 0 for x in utils.getprocesslist(): x = x.lstrip() if x.find( cwd ) < 0: continue pid = x.partition( " " )[0] print( "killing: " + x ) utils.execsys( "/bin/kill " + signal + " " + pid ) killed = killed + 1 return killed
print( "num procs:" + str( len( l ) ) ) if len(l) == 0: print( "no procs" ) try: print( execsys( "/sbin/ifconfig -a" ) ) except Exception,e: print( "can't get interfaces" + str( e ) ) for x in l: x = x.lstrip() if not shouldKill( x ): continue pid = x.partition( " " )[0] print( "killing: " + x ) utils.execsys( "/bin/kill " + signal + " " + pid ) killed = killed + 1 return killed def cleanup( root , nokill ): if nokill: print "nokill requested, not killing anybody" else: if killprocs() > 0: time.sleep(3) killprocs("-9") # delete all regular files, directories can stay
print( "num procs:" + str( len( l ) ) ) if len(l) == 0: print( "no procs" ) try: print( execsys( "/sbin/ifconfig -a" ) ) except Exception,e: print( "can't get interfaces" + str( e ) ) for x in l: x = x.lstrip() if not shouldKill( x, root=root ): continue pid = x.split( " " )[0] print( "killing: " + x ) utils.execsys( "/bin/kill " + signal + " " + pid ) killed = killed + 1 return killed def tryToRemove(path): for _ in range(60): try: os.remove(path) return True except OSError, e: errno = getattr(e, 'winerror', None) # check for the access denied and file in use WindowsErrors if errno in (5, 32): print("os.remove(%s) failed, retrying in one second." % path)