Logo Search packages:      
Sourcecode: waf version File versions  Download package

def wafadmin::Utils::Context::recurse (   self,
  dirs,
  name = '' 
)

The function for calling scripts from folders, it tries to call wscript + function_name
and if that file does not exist, it will call the method 'function_name' from a file named wscript
the dirs can be a list of folders or a string containing space-separated folder paths

Definition at line 574 of file Utils.py.

00574                                       :
            """The function for calling scripts from folders, it tries to call wscript + function_name
            and if that file does not exist, it will call the method 'function_name' from a file named wscript
            the dirs can be a list of folders or a string containing space-separated folder paths
            """
            if not name:
                  name = inspect.stack()[1][3]

            if isinstance(dirs, str):
                  dirs = to_list(dirs)

            for x in dirs:
                  if os.path.isabs(x):
                        nexdir = x
                  else:
                        nexdir = os.path.join(self.curdir, x)

                  base = os.path.join(nexdir, WSCRIPT_FILE)

                  try:
                        txt = readf(base + '_' + name, m='rU')
                  except (OSError, IOError):
                        try:
                              module = load_module(base)
                        except OSError:
                              raise WscriptError('No such script %s' % base)

                        try:
                              f = module.__dict__[name]
                        except KeyError:
                              raise WscriptError('No function %s defined in %s' % (name, base))

                        if getattr(self.__class__, 'pre_recurse', None):
                              self.pre_recurse(f, base, nexdir)
                        old = self.curdir
                        self.curdir = nexdir
                        try:
                              f(self)
                        finally:
                              self.curdir = old
                        if getattr(self.__class__, 'post_recurse', None):
                              self.post_recurse(module, base, nexdir)
                  else:
                        dc = {'ctx': self}
                        if getattr(self.__class__, 'pre_recurse', None):
                              dc = self.pre_recurse(txt, base + '_' + name, nexdir)
                        old = self.curdir
                        self.curdir = nexdir
                        try:
                              try:
                                    exec(txt, dc)
                              except Exception, e:
                                    try:
                                          raise WscriptError(traceback.format_exc(), base)
                                    except:
                                          raise e
                        finally:
                              self.curdir = old
                        if getattr(self.__class__, 'post_recurse', None):
                              self.post_recurse(txt, base + '_' + name, nexdir)

if is_win32:


Generated by  Doxygen 1.6.0   Back to index