X-Git-Url: https://git.tld-linux.org/?p=TLD.git;a=blobdiff_plain;f=pld-builder.new%2FPLD_Builder%2Fpipeutil.py;fp=pld-builder.new%2FPLD_Builder%2Fpipeutil.py;h=0000000000000000000000000000000000000000;hp=4979fea55683bdb0b3f82c59d4d43cad689b92cd;hb=3dc53b6865f716904ad4d02e934e04b3d4855c32;hpb=b235722fd546915a60800f2660d76f684d6f1445 diff --git a/pld-builder.new/PLD_Builder/pipeutil.py b/pld-builder.new/PLD_Builder/pipeutil.py deleted file mode 100644 index 4979fea..0000000 --- a/pld-builder.new/PLD_Builder/pipeutil.py +++ /dev/null @@ -1,41 +0,0 @@ -# vi: encoding=utf-8 ts=8 sts=4 sw=4 et - -import select -import os -import StringIO - -def rw_pipe(buf_, infd, outfd): - buf = StringIO.StringIO() - buf.write(buf_.read()) - ret = StringIO.StringIO() - pos = 0 - rd_fin = 0 - wr_fin = 0 - buf.seek(pos) - while not (rd_fin and wr_fin): - if wr_fin: - o = [] - else: - o = [infd] - if rd_fin: - i = [] - else: - i = [outfd] - i, o, e = select.select(i, o, []) - if i != []: - s = os.read(outfd.fileno(), 1000) - if s == "": - rd_fin = 1 - ret.write(s) - if o != []: - buf.seek(pos) - s = buf.read(1000) - if s == "": - infd.close() - wr_fin = 1 - else: - cnt = os.write(infd.fileno(), s) - pos += cnt - outfd.close() - ret.seek(0) - return ret