Skip to content

handling of python buildInputs #65

@chaoflow

Description

@chaoflow

Currently python packages in propagatedBuildInputs are included into PYTHONPATH and are referenced by a file in the output (propagated-build-native-inputs), which makes them run-time dependencies:

https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/generic/wrap.sh:

_addToPythonPath() {
    local dir="$1"
    if [ -n "${pythonPathsSeen[$dir]}" ]; then return; fi
    pythonPathsSeen[$dir]=1
    addToSearchPath program_PYTHONPATH $dir/lib/@libPrefix@/site-packages
    addToSearchPath program_PATH $dir/bin
    local prop="$dir/nix-support/propagated-build-native-inputs"
    if [ -e $prop ]; then
        local i
        for i in $(cat $prop); do
            _addToPythonPath $i
        done
    fi
}

For ELF programs nix can figure out the run-time dependencies by scanning the executables, this fails for python as the dependencies are not referenced in any file.

DISCUSSION:

  • pth files could include such references and would handle PYTHONPATH manipulation
  • a nix-support/python-build-inputs could list python buildInputs, turning them into run-time dependencies and further they would be used in the above _addToPythonPath

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.topic: pythonPython is a high-level, general-purpose programming language.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions