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

def vcpx::project::Project::_load (   self  )  [private]

Load relevant information from the configuration.

Definition at line 95 of file project.py.

00095                    :
        """
        Load relevant information from the configuration.
        """

        from os import makedirs
        from os.path import join, exists, expanduser, abspath
        from logging import getLogger, CRITICAL, DEBUG, FileHandler, \
             StreamHandler, Formatter

        self.verbose = self.config.get(self.name, 'verbose', False)
        self.rootdir = abspath(expanduser(self.config.get(self.name,
                                                          'root-directory',
                                                          '.')))
        if not exists(self.rootdir):
            makedirs(self.rootdir)
        self.subdir = self.config.get(self.name, 'subdir')
        if not self.subdir:
            self.subdir = '.'

        self.logfile = join(self.rootdir, self.name + '.log')
        self.log = getLogger('tailor.project.%s' % self.name)
        if self.config.get(self.name, 'debug'):
            self.log.setLevel(DEBUG)
        tailorlog = getLogger('tailor')
        formatter = Formatter(self.config.get(
            self.name, 'log-format',
            '%(asctime)s %(levelname)8s: %(message)s', raw=True),
                              self.config.get(
            self.name, 'log-datefmt', '%Y-%m-%d %H:%M:%S', raw=True))
        self.loghandler = FileHandler(self.logfile)
        self.loghandler.setFormatter(formatter)
        self.loghandler.setLevel(DEBUG)
        tailorlog.addHandler(self.loghandler)

        self.source = self.__loadRepository('source')
        self.target = self.__loadRepository('target')
        sfpath = join(self.rootdir,
                      expanduser(self.config.get(self.name,
                                                 'state-file',
                                                 self.name + '.state')))
        self.state_file = StateFile(sfpath, self.config)

        before = self.config.getTuple(self.name, 'before-commit')
        try:
            self.before_commit = [self.config.namespace[f] for f in before]
        except KeyError, e:
            raise ConfigurationError('Project "%s" before-commit references '
                                     'unknown function: %s' %
                                     (self.name, str(e)))

        after = self.config.getTuple(self.name, 'after-commit')
        try:
            self.after_commit = [self.config.namespace[f] for f in after]
        except KeyError, e:
            raise ConfigurationError('Project "%s" after-commit references '
                                     'unknown function: %s' %
                                     (self.name, str(e)))

        if not self.config.get(self.name, 'verbose', False):
            # Disable console output
            rootlog = getLogger()
            rootlog.disabled = True
            for h in rootlog.handlers:
                if isinstance(h, StreamHandler):
                    h.setLevel(CRITICAL)

    def __del__(self):


Generated by  Doxygen 1.6.0   Back to index