Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: make it possible to disable the python setup-hook #56907

Merged
merged 1 commit into from Apr 28, 2019

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Mar 5, 2019

Motivation for this change

Without this it's impossible to use a python binary that depends on a
different python version then what's used during the current build.
I think it would be better to get rid of it in the future and only apply it for a specific set of inputs (eg pythonDepends or move it to mkPythonPackage.

/cc @FRidh

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Without this it's impossible to use a python binary that depends on a
different python version than what's used during the current build.
@FRidh
Copy link
Member

FRidh commented Mar 5, 2019

Without this it's impossible to use a python binary that depends on a
different python version then what's used during the current build.

I don't follow you here. The hook sets PYTHONPATH. How can that in any way prevent you from doing something?

@LnL7
Copy link
Member Author

LnL7 commented Mar 5, 2019

Here's a simple example. Having mkPythonPackage bring packages into scope automatically is fine, but there are cases where a build wants more than one interpreter available without pulling in propagated packages through PYTHONPATH.

{ stdenv, python3, awscli }:

stdenv.mkDerivation {
  name = "example";
  buildInputs = [ python3 awscli ];
  buildCommand = ''
    python3 -c 'import sys'
    touch $out
  '';
}

@FRidh FRidh merged commit a76e11a into NixOS:staging Apr 28, 2019
@FRidh
Copy link
Member

FRidh commented Apr 28, 2019

I see, thanks. Even when we fix Python applications so their modules don't get picked up, the hook could still pick up modules from other packages which may not always be intended.

@LnL7 LnL7 deleted the python-no-pythonpath branch April 30, 2019 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants