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)
Beispiel #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.
        """
        try:
            exclude_paths = (self.config.exclude_patterns +
                             self.config.templates_path +
                             builder.get_asset_paths())
            self.project.discover(exclude_paths)

            # 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))
Beispiel #3
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:
            exclude_paths = (self.config.exclude_patterns +
                             self.config.templates_path +
                             builder.get_asset_paths())
            self.project.discover(exclude_paths)

            # 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))
Beispiel #4
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)
Beispiel #5
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))