File: hatch_build.py

package info (click to toggle)
octave-kernel 0.36.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 572 kB
  • sloc: python: 444; makefile: 27
file content (19 lines) | stat: -rw-r--r-- 695 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""A custom hatch build hook for octave_kernel."""
import shutil
from pathlib import Path

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


class CustomHook(BuildHookInterface):
    """The octave_kernel build hook."""

    def initialize(self, version, build_data):
        """Initialize the hook."""
        here = Path(__file__).parent.resolve()
        jupyter_data = here /"jupyter-data"
        if jupyter_data.exists():
            shutil.rmtree(jupyter_data)
        jupyter_data.mkdir()
        shutil.copy(here / "octave_kernel" / "kernel.json", jupyter_data / "kernel.json")
        shutil.copytree(here / "octave_kernel" / "images",  jupyter_data / "images")