documentation of rosmake functions

This commit is contained in:
Tully Foote 2009-10-28 21:16:37 +00:00
parent 9254c502bd
commit 7e99c64d58
1 changed files with 15 additions and 2 deletions

View File

@ -63,7 +63,7 @@ class DependencyTracker:
caching way to call roslib. It also will allow you to specifiy a
range of packages over which to track dependencies. This is useful
if you are only building a subset of the tree. For example with the
--specified-only optoion. """
--specified-only option. """
def __init__(self, valid_packages = roslib.rospack.rospackexec(["list-names"]).split()):
self.valid_packages = valid_packages
self.deps_1 = {}
@ -91,6 +91,10 @@ class DependencyTracker:
class CompileThread(threading.Thread):
""" This is the class which is used as the thread for parallel
builds. This class will query the build queue object for new
commands and block on its calls until the build queue says that
building is done. """
def __init__(self, name, build_queue, rosmakeall, argument = None):
threading.Thread.__init__(self)
self.build_queue = build_queue
@ -143,18 +147,24 @@ class BuildQueue:
def is_done(self):
"""Return if the build queue has been completed """
return self._done
def succeded(self):
""" Return whether the build queue has completed all packages successfully. """
return len( self.built) == self._total_pkgs and self._done
def stop(self): #
def stop(self):
""" Stop the build queue, including waking all blocking
threads. It will not stop in flight builds."""
self._done = True
self.condition.acquire()
self.condition.notifyAll() # wake any blocking threads
self.condition.release()
def return_built(self, package): # mark that a package is built
""" The thread which completes a package marks it as done with
this method."""
self.condition.acquire()
self.built.append(package)
if len(self.built) == self._total_pkgs: #flag that we're finished
@ -163,6 +173,9 @@ class BuildQueue:
self.condition.release()
def get_valid_package(self): # blocking call to get a package to build returns none if done
""" This is a blocking call which will return a package which has
all dependencies met. If interrupted or done it will return
None"""
self.condition.acquire()
while (not self._done and len(self.to_build) > 0):
for p in self.to_build: