parameters: (self, dir, jamfile_module)
docstring: Load a Jamfile at the given directory. Returns nothing.
          Will attempt to load the file as indicated by the JAMFILE patterns.
          Effect of calling this rule twice with the same 'dir' is underfined.
docstring_summary: Load a Jamfile at the given directory. Returns nothing.
          Will attempt to load the file as indicated by the JAMFILE patterns.
          Effect of calling this rule twice with the same 'dir' is underfined.
docstring_tokens: Load a Jamfile at the given directory . Returns nothing . Will attempt to load the file as indicated by the JAMFILE patterns . Effect of calling this rule twice with the same dir is underfined .
function: def load_jamfile(self, dir, jamfile_module):
          """Load a Jamfile at the given directory. Returns nothing.
          Will attempt to load the file as indicated by the JAMFILE patterns.
          Effect of calling this rule twice with the same 'dir' is underfined."""
          assert isinstance(dir, basestring)
          assert isinstance(jamfile_module, basestring)
  
          # See if the Jamfile is where it should be.
          is_jamroot = False
          jamfile_to_load = b2.util.path.glob([dir], self.JAMROOT)
          if not jamfile_to_load:
              jamfile_to_load = self.find_jamfile(dir)
          else:
              if len(jamfile_to_load) > 1:
                  get_manager().errors()("Multiple Jamfiles found at '%s'\n" +\
                                         "Filenames are: %s"
                                         % (dir, [os.path.basename(j) for j in jamfile_to_load]))
  
              is_jamroot = True
              jamfile_to_load = jamfile_to_load[0]
  
          dir = os.path.dirname(jamfile_to_load)
          if not dir:
              dir = "."
  
          self.used_projects[jamfile_module] = []
  
          # Now load the Jamfile in it's own context.
          # The call to 'initialize' may load parent Jamfile, which might have
          # 'use-project' statement that causes a second attempt to load the
          # same project we're loading now.  Checking inside .jamfile-modules
          # prevents that second attempt from messing up.
          if not jamfile_module in self.jamfile_modules:
              self.jamfile_modules[jamfile_module] = True
  
              # Initialize the jamfile module before loading.
              #
              self.initialize(jamfile_module, dir, os.path.basename(jamfile_to_load))
  
              saved_project = self.current_project
  
              bjam.call("load", jamfile_module, jamfile_to_load)
              basename = os.path.basename(jamfile_to_load)
  
              if is_jamroot:
                  jamfile = self.find_jamfile(dir, no_errors=True)
                  if jamfile:
                      bjam.call("load", jamfile_module, jamfile)
  
          # Now do some checks
          if self.current_project != saved_project:
              self.manager.errors()(
  """The value of the .current-project variable
  has magically changed after loading a Jamfile.
  This means some of the targets might be defined a the wrong project.
  after loading %s
  expected value %s
  actual value %s""" % (jamfile_module, saved_project, self.current_project))
  
          if self.global_build_dir:
              id = self.attributeDefault(jamfile_module, "id", None)
              project_root = self.attribute(jamfile_module, "project-root")
              location = self.attribute(jamfile_module, "location")
  
              if location and project_root == dir:
                  # This is Jamroot
                  if not id:
                      # FIXME: go via errors module, so that contexts are
                      # shown?
                      print "warning: the --build-dir option was specified"
                      print "warning: but Jamroot at '%s'" % dir
                      print "warning: specified no project id"
                      print "warning: the --build-dir option will be ignored"
function_tokens: def load_jamfile ( self , dir , jamfile_module ) : assert isinstance ( dir , basestring ) assert isinstance ( jamfile_module , basestring ) # See if the Jamfile is where it should be. is_jamroot = False jamfile_to_load = b2 . util . path . glob ( [ dir ] , self . JAMROOT ) if not jamfile_to_load : jamfile_to_load = self . find_jamfile ( dir ) else : if len ( jamfile_to_load ) > 1 : get_manager ( ) . errors ( ) ( "Multiple Jamfiles found at '%s'\n" + "Filenames are: %s" % ( dir , [ os . path . basename ( j ) for j in jamfile_to_load ] ) ) is_jamroot = True jamfile_to_load = jamfile_to_load [ 0 ] dir = os . path . dirname ( jamfile_to_load ) if not dir : dir = "." self . used_projects [ jamfile_module ] = [ ] # Now load the Jamfile in it's own context. # The call to 'initialize' may load parent Jamfile, which might have # 'use-project' statement that causes a second attempt to load the # same project we're loading now.  Checking inside .jamfile-modules # prevents that second attempt from messing up. if not jamfile_module in self . jamfile_modules : self . jamfile_modules [ jamfile_module ] = True # Initialize the jamfile module before loading. # self . initialize ( jamfile_module , dir , os . path . basename ( jamfile_to_load ) ) saved_project = self . current_project bjam . call ( "load" , jamfile_module , jamfile_to_load ) basename = os . path . basename ( jamfile_to_load ) if is_jamroot : jamfile = self . find_jamfile ( dir , no_errors = True ) if jamfile : bjam . call ( "load" , jamfile_module , jamfile ) # Now do some checks if self . current_project != saved_project : self . manager . errors ( ) ( """The value of the .current-project variable
  has magically changed after loading a Jamfile.
  This means some of the targets might be defined a the wrong project.
  after loading %s
  expected value %s
  actual value %s""" % ( jamfile_module , saved_project , self . current_project ) ) if self . global_build_dir : id = self . attributeDefault ( jamfile_module , "id" , None ) project_root = self . attribute ( jamfile_module , "project-root" ) location = self . attribute ( jamfile_module , "location" ) if location and project_root == dir : # This is Jamroot if not id : # FIXME: go via errors module, so that contexts are # shown? print "warning: the --build-dir option was specified" print "warning: but Jamroot at '%s'" % dir print "warning: specified no project id" print "warning: the --build-dir option will be ignored"