[Git][reproducible-builds/diffoscope][master] 2 commits: Correct spelling of ereser to eraser.
Chris Lamb
gitlab at salsa.debian.org
Thu Aug 23 13:14:16 CEST 2018
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
35224764 by Daniel Kahn Gillmor at 2018-08-23T11:13:12Z
Correct spelling of ereser to eraser.
Signed-off-by: Chris Lamb <lamby at debian.org>
- - - - -
038ac847 by Daniel Kahn Gillmor at 2018-08-23T11:13:36Z
Avoid line eraser error on dumb terminals. (Closes: #906967)
Try the following:
touch a b
TERM=dumb diffoscope a b
The result is some nasty warnings about:
AttributeError: 'bytes' object has no attribute 'format'
This patch fixes the problem.
Signed-off-by: Chris Lamb <lamby at debian.org>
- - - - -
4 changed files:
- diffoscope/comparators/__init__.py
- diffoscope/logging.py
- diffoscope/main.py
- diffoscope/progress.py
Changes:
=====================================
diffoscope/comparators/__init__.py
=====================================
--- a/diffoscope/comparators/__init__.py
+++ b/diffoscope/comparators/__init__.py
@@ -24,7 +24,7 @@ import logging
import importlib
import traceback
-from ..logging import line_ereser
+from ..logging import line_eraser
logger = logging.getLogger(__name__)
@@ -134,7 +134,7 @@ class ComparatorManager(object):
))
for x in errors:
logger.error("Original error for %s:", x[0])
- sys.stderr.buffer.write(line_ereser())
+ sys.stderr.buffer.write(line_eraser())
traceback.print_exception(None, x[1], x[1].__traceback__)
sys.exit(2)
=====================================
diffoscope/logging.py
=====================================
--- a/diffoscope/logging.py
+++ b/diffoscope/logging.py
@@ -22,20 +22,20 @@ import contextlib
import logging
-def line_ereser(fd=sys.stderr) -> bytes:
- ereser = b'' # avoid None to avoid 'NoneType + str/bytes' failures
+def line_eraser(fd=sys.stderr) -> bytes:
+ eraser = b'' # avoid None to avoid 'NoneType + str/bytes' failures
if fd.isatty():
from curses import tigetstr, setupterm
setupterm(fd=fd.fileno())
- ereser = tigetstr('el')
+ eraser = tigetstr('el')
- if not ereser and fd.isatty():
- # is a tty, but doesn't support the proper scape code, so let's fake it
+ if not eraser and fd.isatty():
+ # is a tty, but doesn't support the proper escape code, so let's fake it
from shutil import get_terminal_size
width = get_terminal_size().columns
- ereser = b'\r{}\r'.format(b' ' * width)
+ eraser = b'\r' + (b' ' * width) + b'\r'
- return ereser
+ return eraser
@contextlib.contextmanager
@@ -49,7 +49,7 @@ def setup_logging(debug, log_handler):
logger.addHandler(ch)
formatter = logging.Formatter(
- line_ereser().decode('ascii') +
+ line_eraser().decode('ascii') +
'%(asctime)s %(levelname).1s: %(name)s: %(message)s',
'%Y-%m-%d %H:%M:%S',
)
=====================================
diffoscope/main.py
=====================================
--- a/diffoscope/main.py
+++ b/diffoscope/main.py
@@ -33,7 +33,7 @@ from .path import set_path
from .tools import tool_prepend_prefix, tool_required, OS_NAMES, get_current_os
from .config import Config
from .locale import set_locale
-from .logging import line_ereser, setup_logging
+from .logging import line_eraser, setup_logging
from .progress import ProgressManager, Progress
from .profiling import ProfileManager, profile
from .tempfiles import clean_all_temp_files
@@ -464,7 +464,7 @@ def main(args=None):
except BrokenPipeError:
sys.exit(2)
except Exception:
- sys.stderr.buffer.write(line_ereser())
+ sys.stderr.buffer.write(line_eraser())
traceback.print_exc()
if parsed_args and parsed_args.debugger:
import pdb
=====================================
diffoscope/progress.py
=====================================
--- a/diffoscope/progress.py
+++ b/diffoscope/progress.py
@@ -24,7 +24,7 @@ import json
import signal
import logging
-from .logging import line_ereser
+from .logging import line_eraser
logger = logging.getLogger(__name__)
@@ -218,7 +218,7 @@ class ProgressBar(object):
kwargs.setdefault('fd', sys.stderr)
super().__init__(*args, **kwargs)
# Terminal handling after parent init since that sets self.fd
- self.erase_to_eol = line_ereser(self.fd)
+ self.erase_to_eol = line_eraser(self.fd)
def _need_update(self):
return True
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/8b90ec1a4e0c0c73bb67936e80eb898366b67a6f...038ac84771628123b0518d5c91690602c1e17a91
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/8b90ec1a4e0c0c73bb67936e80eb898366b67a6f...038ac84771628123b0518d5c91690602c1e17a91
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20180823/e24c14d3/attachment.html>
More information about the rb-commits
mailing list