Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
arthw committed Nov 7, 2024
1 parent 1d2e3d9 commit 767ad2b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ html: content
@echo making HTML content
$(Q)./scripts/show-versions.py
@echo zjy make html
$(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b html -d $(BUILDDIR)/doctrees $(SOURCEDIR) $(BUILDDIR)/html $(SPHINXOPTS) $(OPTS)
#@echo zjy filter doc in log
$(Q)$(SPHINXBUILD) -t $(DOC_TAG) -b html -d $(BUILDDIR)/doctrees $(SOURCEDIR) $(BUILDDIR)/html $(SPHINXOPTS) $(OPTS) > $(BUILDDIR)/doc.log 2>&1
$(Q)./scripts/filter-doc-log.sh $(BUILDDIR)/doc.log
@echo zjy done
singlehtml: content
Expand Down
31 changes: 16 additions & 15 deletions scripts/filter-known-issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,27 @@ def filter_log(args):
continue # skip empty log files
try:
with open(filename, "r+b") as f:
# logging.info("%s: filtering", filename)
logging.info("%s: filtering", filename)
# Yeah, this should be more protected in case of exception
# and such, but this is a short running program...
mm = mmap.mmap(f.fileno(), 0)
print("exclude_regexs", exclude_regexs)
for ex, origin, flags in exclude_regexs:
# logging.info("%s: searching from %s: %s",
# filename, origin, ex.pattern)
logging.info("%s: searching from %s: %s",
filename, origin, ex.pattern)
for m in re.finditer(ex.pattern, mm, re.MULTILINE):
# logging.info("%s: %s-%s: match from from %s %s",
# filename, m.start(), m.end(), origin, flags)
logging.info("%s: %s-%s: match from from %s %s",
filename, m.start(), m.end(), origin, flags)
if 'warning' in flags:
exclude_ranges.append((m.start(), m.end(), True))
else:
exclude_ranges.append((m.start(), m.end(), False))

exclude_ranges = sorted(exclude_ranges, key=lambda r: r[0])
# logging.warning(
# "%s: ranges excluded: %s",
# filename,
# exclude_ranges)
logging.warning(
"%s: ranges excluded: %s",
filename,
exclude_ranges)

# Decide what to do with what has been filtered; warnings
# go to stderr and warnings file, errors to stdout, what
Expand All @@ -168,14 +169,14 @@ def filter_log(args):
mm.seek(offset)
if b > offset:
# We have something not caught by a filter, an error
# logging.info("%s: error range (%d, %d), from %d %dB",
# filename, offset, b, offset, b - offset)
logging.info("%s: error range (%d, %d), from %d %dB",
filename, offset, b, offset, b - offset)
print_error(fout, mm.read(b - offset))
mm.seek(b)
if warning == True: # A warning, print it
mm.seek(b)
# logging.info("%s: warning range (%d, %d), from %d %dB",
# filename, b, e, offset, e - b)
logging.info("%s: warning range (%d, %d), from %d %dB",
filename, b, e, offset, e - b)
print_error(fout, mm.read(e - b))
else: # Exclude, ignore it
d = b - offset
Expand All @@ -184,8 +185,8 @@ def filter_log(args):
offset = e
mm.seek(offset)
if len(mm) != offset:
# logging.info("%s: error final range from %d %dB",
# filename, offset, len(mm))
logging.info("%s: error final range from %d %dB",
filename, offset, len(mm))
print_error(fout, mm.read(len(mm) - offset - 1))
del mm
f.close()
Expand Down

0 comments on commit 767ad2b

Please sign in to comment.