Ejemplo n.º 1
0
 def find_files(self, config):
     """
     Find all source files in the source dir and put them in self.found_docs.
     """
     self.found_docs = set(get_matching_docs(self.srcdir, config.source_suffix,
                                             exclude=set(config.unused_docs),
                                             prune=['_sources']))
Ejemplo n.º 2
0
    def find_files(self, config, builder):
        # type: (Config, Builder) -> None
        """Find all source files in the source dir and put them in
        self.found_docs.
        """
        matchers = compile_matchers(
            config.exclude_patterns[:] + config.templates_path +
            builder.get_asset_paths() +
            ['**/_sources', '.#*', '**/.#*', '*.lproj/**'])
        self.found_docs = set()
        for docname in get_matching_docs(
                self.srcdir,
                config.source_suffix,  # type: ignore
                exclude_matchers=matchers):
            if os.access(self.doc2path(docname), os.R_OK):
                self.found_docs.add(docname)
            else:
                logger.warning("document not readable. Ignored.",
                               location=docname)

        # Current implementation is applying translated messages in the reading
        # phase.Therefore, in order to apply the updated message catalog, it is
        # necessary to re-process from the reading phase. Here, if dependency
        # is set for the doc source and the mo file, it is processed again from
        # the reading phase when mo is updated. In the future, we would like to
        # move i18n process into the writing phase, and remove these lines.
        if builder.use_message_catalog:
            # add catalog mo file dependency
            for docname in self.found_docs:
                catalog_files = find_catalog_files(docname, self.srcdir,
                                                   self.config.locale_dirs,
                                                   self.config.language,
                                                   self.config.gettext_compact)
                for filename in catalog_files:
                    self.dependencies[docname].add(filename)
Ejemplo n.º 3
0
    def find_files(self, config):
        """Find all source files in the source dir and put them in
        self.found_docs.
        """
        matchers = compile_matchers(
            config.exclude_patterns[:] +
            config.templates_path +
            config.html_extra_path +
            ['**/_sources', '.#*', '**/.#*', '*.lproj/**']
        )
        self.found_docs = set()
        for docname in get_matching_docs(self.srcdir, config.source_suffix,
                                         exclude_matchers=matchers):
            if os.access(self.doc2path(docname), os.R_OK):
                self.found_docs.add(docname)
            else:
                self.warn(docname, "document not readable. Ignored.")

        # add catalog mo file dependency
        for docname in self.found_docs:
            catalog_files = find_catalog_files(
                docname,
                self.srcdir,
                self.config.locale_dirs,
                self.config.language,
                self.config.gettext_compact)
            for filename in catalog_files:
                self.dependencies.setdefault(docname, set()).add(filename)
Ejemplo n.º 4
0
 def find_files(self, config):
     """
     Find all source files in the source dir and put them in self.found_docs.
     """
     exclude_dirs = [d.replace(SEP, path.sep) for d in config.exclude_dirs]
     self.found_docs = set(get_matching_docs(
         self.srcdir, config.source_suffix, exclude_docs=set(config.unused_docs),
         exclude_dirs=exclude_dirs, prune_dirs=['_sources']))
Ejemplo n.º 5
0
 def find_files(self, config):
     """
     Find all source files in the source dir and put them in self.found_docs.
     """
     self.found_docs = set(
         get_matching_docs(self.srcdir,
                           config.source_suffix,
                           exclude=set(config.unused_docs),
                           prune=['_sources']))
Ejemplo n.º 6
0
 def find_files(self, config):
     """
     Find all source files in the source dir and put them in self.found_docs.
     """
     exclude_dirs = [d.replace(SEP, path.sep) for d in config.exclude_dirs]
     self.found_docs = set(
         get_matching_docs(self.srcdir,
                           config.source_suffix,
                           exclude_docs=set(config.unused_docs),
                           exclude_dirs=exclude_dirs,
                           prune_dirs=['_sources']))
Ejemplo n.º 7
0
    def find_files(self, config, builder):
        # type: (Config, Builder) -> None
        """Find all source files in the source dir and put them in
        self.found_docs.
        """
        try:
            matchers = compile_matchers(
                config.exclude_patterns[:] +
                config.templates_path +
                builder.get_asset_paths() +
                ['**/_sources', '.#*', '**/.#*', '*.lproj/**']
            )
            self.found_docs = set()
            for docname in get_matching_docs(self.srcdir, config.source_suffix,  # type: ignore
                                             exclude_matchers=matchers):
                if os.access(self.doc2path(docname), os.R_OK):
                    self.found_docs.add(docname)
                else:
                    logger.warning(__("document not readable. Ignored."), location=docname)

            # Current implementation is applying translated messages in the reading
            # phase.Therefore, in order to apply the updated message catalog, it is
            # necessary to re-process from the reading phase. Here, if dependency
            # is set for the doc source and the mo file, it is processed again from
            # the reading phase when mo is updated. In the future, we would like to
            # move i18n process into the writing phase, and remove these lines.
            if builder.use_message_catalog:
                # add catalog mo file dependency
                for docname in self.found_docs:
                    catalog_files = find_catalog_files(
                        docname,
                        self.srcdir,
                        self.config.locale_dirs,
                        self.config.language,
                        self.config.gettext_compact)
                    for filename in catalog_files:
                        self.dependencies[docname].add(filename)
        except EnvironmentError as exc:
            raise DocumentError(__('Failed to scan documents in %s: %r') % (self.srcdir, exc))