summaryrefslogtreecommitdiff
path: root/engine/SCons/Job.py
diff options
context:
space:
mode:
Diffstat (limited to 'engine/SCons/Job.py')
-rw-r--r--engine/SCons/Job.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/engine/SCons/Job.py b/engine/SCons/Job.py
index ed8a5e6..a126d1c 100644
--- a/engine/SCons/Job.py
+++ b/engine/SCons/Job.py
@@ -7,7 +7,7 @@ stop, and wait on jobs.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -29,7 +29,7 @@ stop, and wait on jobs.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Job.py 74b2c53bc42290e911b334a6b44f187da698a668 2017/11/14 13:16:53 bdbaddog"
+__revision__ = "src/engine/SCons/Job.py 72ae09dc35ac2626f8ff711d8c4b30b6138e08e3 2019-08-08 14:50:06 bdeegan"
import SCons.compat
@@ -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:
+ 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.