changeset 110:f148c2366faa

back to IGzipFile
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Thu, 22 Apr 2021 21:31:03 +0000
parents 15abf4aab307
children 3119bca71181
files bin/ix.py
diffstat 1 files changed, 3 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/bin/ix.py	Thu Apr 22 21:10:02 2021 +0000
+++ b/bin/ix.py	Thu Apr 22 21:31:03 2021 +0000
@@ -9,8 +9,8 @@
 Note that if no output flag(s) is/are given, the whole WARC record will be output, more efficiently than would be the case if -whb is given.'''
 
 import sys, argparse, regex, os, shutil, io, gzip, time
-#from isal import igzip
-from subprocess import Popen, PIPE
+from isal import igzip
+#from subprocess import Popen, PIPE
 #import asyncio
 
 HACK_USAGE=regex.compile('\[-x\]\n\s*\[length\] \[offset\] \[filename\]')
@@ -50,19 +50,9 @@
     if options.zipped:
       BINOUT.write(bv)
     else:
-      #gzip_chunk = io.BytesIO(bv)
+      gzip_chunk = io.BytesIO(bv)
       uv=memoryview(buf)[length:]
       #clear_bytes=io.BytesIO(uv)
-      p = Popen(["/lustre/home/dc007/hst/gentoo/usr/bin/igzip",
-                                  "-dc"],
-                 stdin=PIPE,
-                 stdout=None)
-      fout, ferr = p.communicate(bv)
-      res=p.wait()
-      if res!=0:
-        print('pipe failed',res,ferr.decode())
-        exit(2)
-      return
       with igzip.IGzipFile(fileobj=gzip_chunk) as gzip_fin:
         while True:
           l=gzip_fin.readinto(uv)