def CHECK_EXTRACT_CMD(state, package_tarball_paths):
 if (not package_tarball_paths):
  return
 def extracted_size(tarball_path):
  with tarfile.open(tarball_path) as tar_bz2:
   return reduce(add, (m.size for m in tar_bz2.getmembers()), 0)
 size = reduce(add, (extracted_size(dist) for dist in package_tarball_paths), 0)
 prefix = state['prefix']
 assert isdir(prefix)
 check_size(prefix, size)

def CHECK_EXTRACT_CMD ( state , package_tarball_paths ) : if ( not package_tarball_paths ) : return def extracted_size ( tarball_path ) : with tarfile . open ( tarball_path ) as tar_bz2 : return reduce ( add , ( m . size for m in tar_bz2 . getmembers ( ) ) , 0 ) size = reduce ( add , ( extracted_size ( dist ) for dist in package_tarball_paths ) , 0 ) prefix = state [ 'prefix' ] assert isdir ( prefix ) check_size ( prefix , size )
check whether there is enough space for extract packages .