diff options
author | Mats Wichmann <mats@linux.com> | 2019-04-27 19:17:30 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-04-27 19:39:27 (GMT) |
commit | c1ae73ae94b8437aed7e4ffd10b50620580d305f (patch) | |
tree | 7fad3106ede247c42724a6a356c2c6a5c8e81f71 /src/engine/SCons/Job.py | |
parent | d642ba8c6ee147daa8155b6a354ce66a13bb9188 (diff) | |
download | SCons-c1ae73ae94b8437aed7e4ffd10b50620580d305f.zip SCons-c1ae73ae94b8437aed7e4ffd10b50620580d305f.tar.gz SCons-c1ae73ae94b8437aed7e4ffd10b50620580d305f.tar.bz2 |
Some more lint-derived cleanups
Consistently use "not is" and "not in", many instances used
the form "not x is y" instead, which pylint objected to.
A couple of bare except clauses got a qualifier.
Files otherwise touched had trailing whitespace cleaned up as well.
These are all things that sider would complain about if a change
happened nearby, so this is pre-emptive.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src/engine/SCons/Job.py')
-rw-r--r-- | src/engine/SCons/Job.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/engine/SCons/Job.py b/src/engine/SCons/Job.py index 3720ca2..d70125c 100644 --- a/src/engine/SCons/Job.py +++ b/src/engine/SCons/Job.py @@ -53,14 +53,14 @@ interrupt_msg = 'Build interrupted.' class InterruptState(object): - def __init__(self): - self.interrupted = False + def __init__(self): + self.interrupted = False - def set(self): - self.interrupted = True + def set(self): + self.interrupted = True - def __call__(self): - return self.interrupted + def __call__(self): + return self.interrupted class Jobs(object): @@ -87,7 +87,7 @@ class Jobs(object): stack_size = explicit_stack_size if stack_size is None: stack_size = default_stack_size - + try: self.job = Parallel(taskmaster, num, stack_size) self.num_jobs = num @@ -172,14 +172,14 @@ class Serial(object): """ def __init__(self, taskmaster): - """Create a new serial job given a taskmaster. + """Create a new serial job given a taskmaster. The taskmaster's next_task() method should return the next task that needs to be executed, or None if there are no more tasks. The taskmaster's executed() method will be called for each task when it is successfully executed, or failed() will be called if it failed to execute (e.g. execute() raised an exception).""" - + self.taskmaster = taskmaster self.interrupted = InterruptState() @@ -188,7 +188,7 @@ class Serial(object): and executing them, and return when there are no more tasks. If a task fails to execute (i.e. execute() raises an exception), then the job will stop.""" - + while True: task = self.taskmaster.next_task() @@ -199,7 +199,7 @@ class Serial(object): task.prepare() if task.needs_execute(): task.execute() - except Exception as e: + except Exception: if self.interrupted(): try: raise SCons.Errors.BuildError( @@ -269,7 +269,7 @@ else: def __init__(self, num, stack_size, interrupted): """Create the request and reply queues, and 'num' worker threads. - + One must specify the stack size of the worker threads. The stack size is specified in kilobytes. """ @@ -277,11 +277,11 @@ else: self.resultsQueue = queue.Queue(0) try: - prev_size = threading.stack_size(stack_size*1024) + prev_size = threading.stack_size(stack_size*1024) except AttributeError as e: # Only print a warning if the stack size has been # explicitly set. - if not explicit_stack_size is None: + if explicit_stack_size is not None: msg = "Setting stack size is unsupported by this version of Python:\n " + \ e.args[0] SCons.Warnings.warn(SCons.Warnings.StackSizeWarning, msg) @@ -322,7 +322,7 @@ else: self.requestQueue.put(None) # Wait for all of the workers to terminate. - # + # # If we don't do this, later Python versions (2.4, 2.5) often # seem to raise exceptions during shutdown. This happens # in requestQueue.get(), as an assertion failure that @@ -339,7 +339,7 @@ else: self.workers = [] class Parallel(object): - """This class is used to execute tasks in parallel, and is somewhat + """This class is used to execute tasks in parallel, and is somewhat less efficient than Serial, but is appropriate for parallel builds. This class is thread safe. @@ -373,7 +373,7 @@ else: an exception), then the job will stop.""" jobs = 0 - + while True: # Start up as many available tasks as we're # allowed to. |