summary refs log tree commit diff
path: root/pkgs/development/tools/poetry2nix/poetry2nix/hooks/remove-special-dependencies.sh
blob: 904efa615b1dccfe4b8c2a016375dda5651c2eb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
remove-@kind@-dependencies-hook() {
    # Tell poetry not to resolve special dependencies. Any version is fine!

    if ! test -f pyproject.toml; then
        return
    fi

    echo "Removing @kind@ dependencies"

    # NOTE: We have to reset PYTHONPATH to avoid having propagatedBuildInputs
    # from the currently building derivation leaking into our unrelated Python
    # environment.
    PYTHONPATH=@pythonPath@ \
    @pythonInterpreter@ \
    @pyprojectPatchScript@ \
      --fields-to-remove @fields@ < pyproject.toml > pyproject.formatted.toml

    mv pyproject.formatted.toml pyproject.toml

    echo "Finished removing @kind@ dependencies"
}

postPatchHooks+=(remove-@kind@-dependencies-hook)