File: hatch_build.py

package info (click to toggle)
python-mkdocs 1.4.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,640 kB
  • sloc: python: 12,310; javascript: 2,315; perl: 142; sh: 84; makefile: 24; xml: 12
file content (14 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os

from hatchling.builders.hooks.plugin.interface import BuildHookInterface


class CustomBuildHook(BuildHookInterface):
    def initialize(self, version, build_data):
        from babel.messages.frontend import compile_catalog

        for theme in 'mkdocs', 'readthedocs':
            cmd = compile_catalog()
            cmd.directory = os.path.join('mkdocs', 'themes', theme, 'locales')
            cmd.finalize_options()
            cmd.run()