diff options
author | alalazo <massimiliano.culpo@googlemail.com> | 2016-08-11 09:08:00 +0200 |
---|---|---|
committer | alalazo <massimiliano.culpo@googlemail.com> | 2016-08-11 09:08:00 +0200 |
commit | f5433477b9f7c98ca00947cf1b1fdc106cca1080 (patch) | |
tree | 84e321e6b3eccfaac4c59aa8dba3bf71bdfa8c12 /lib/spack/llnl/util/tty/log.py | |
parent | b4b9ebe7d718d169dd5f2ab41d4cbc00fed88641 (diff) | |
download | spack-f5433477b9f7c98ca00947cf1b1fdc106cca1080.tar.gz spack-f5433477b9f7c98ca00947cf1b1fdc106cca1080.tar.bz2 spack-f5433477b9f7c98ca00947cf1b1fdc106cca1080.tar.xz spack-f5433477b9f7c98ca00947cf1b1fdc106cca1080.zip |
qa : flake8 issues
Diffstat (limited to 'lib/spack/llnl/util/tty/log.py')
-rw-r--r-- | lib/spack/llnl/util/tty/log.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/spack/llnl/util/tty/log.py b/lib/spack/llnl/util/tty/log.py index 25ed5254a5..a4ba2a9bdf 100644 --- a/lib/spack/llnl/util/tty/log.py +++ b/lib/spack/llnl/util/tty/log.py @@ -24,12 +24,11 @@ ############################################################################## """Utility classes for logging the output of blocks of code. """ -import sys +import multiprocessing import os import re import select -import inspect -import multiprocessing +import sys import llnl.util.tty as tty import llnl.util.tty.color as color @@ -117,9 +116,10 @@ class log_output(object): # do things ... output will be logged # and also printed to stdout. - Opens a stream in 'w' mode at daemon spawning and closes it at daemon joining. - If echo is True, also prints the output to stdout. + Opens a stream in 'w' mode at daemon spawning and closes it at + daemon joining. If echo is True, also prints the output to stdout. """ + def __init__(self, filename, echo=False, force_color=False, debug=False): self.filename = filename # Various output options @@ -133,7 +133,11 @@ class log_output(object): self.read, self.write = os.pipe() # Sets a daemon that writes to file what it reads from a pipe - self.p = multiprocessing.Process(target=self._spawn_writing_daemon, args=(self.read,), name='logger_daemon') + self.p = multiprocessing.Process( + target=self._spawn_writing_daemon, + args=(self.read,), + name='logger_daemon' + ) self.p.daemon = True # Needed to un-summon the daemon self.parent_pipe, self.child_pipe = multiprocessing.Pipe() @@ -186,6 +190,7 @@ class log_output(object): os.close(self.read) class OutputRedirection(object): + def __init__(self, other): self.__dict__.update(other.__dict__) |