-
-
Save FRidh/84dd06b8af60bdb405aa89121c8f928c to your computer and use it in GitHub Desktop.
Find python packages that are likely to fail when used through "nix-shell -p"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Produce a list of derivations that should likely have pythonPath set | |
with import <nixpkgs> {}; | |
with builtins; | |
let | |
# Package set to check | |
pythonPackages = pkgs.python2Packages; | |
# evaluate expr, returning default on error | |
tryDefault = expr: default: | |
let | |
res = (tryEval expr); | |
in if res.success then res.value else default; | |
isPython = pkg: pkg?name && (parseDrvName pkg.name).name == "python"; | |
hasPropagatedPython = pkg: (pkg?propagatedNativeBuildInputs && (length (filter isPython pkg.propagatedNativeBuildInputs)) > 0); | |
# Skip broken packages and packages that don't support the given python version | |
validPythonPackage = pkg: tryDefault (pkg?disabled -> !pkg.disabled) false; | |
validPythonPackages = pkgs: (filter validPythonPackage (attrValues pkgs)); | |
withoutPropagatedPython = pkgs: filter (pkg: tryDefault (pkg?name && !(hasPropagatedPython pkg)) false) (validPythonPackages pkgs); | |
pkgsWithoutPropagatedPython = builtins.map (pkg: pkg.name) (withoutPropagatedPython pythonPackages); | |
in pkgs.writeTextFile { | |
name = "python-packages-without-pythonpath.json"; | |
text = toJSON pkgsWithoutPropagatedPython; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment