Esempio n. 1
0
    def _spec_paths(self):
        config = Config()
        paths = config.get('paths', 'spec').split(':')

        def abs_map(p):
            if p.startswith('/'):
                return p
            base = config.get('runtime', 'base_dir')
            return os.path.join(base, p)

        return map(abs_map, paths)
Esempio n. 2
0
    def _find_file(self):
        config = Config()
        paths = self._spec_paths()
        log.info("Spec. file search paths (ordered): " + str(paths))
        filename = "{}.{}".format(self.name, config.get('constants',
                                                        'specfile_ext'))
        for path in paths:
            complete_path = os.path.join(path, filename)
            if os.path.exists(complete_path):
                self.filename = complete_path
                log.info("Spec. file for {} is '{}'".format(self.name,
                                                            self.filename))
                return complete_path

        raise Exception("Spec '{}' not found".format(self.name))