google-cloud-sdk: prefer using a pythonEnv vs just a search path

Previously only direct dependencies were available in the python search
path. Transitive dependencies would not be available and thus a few
features would not work due to import errors. Those import errors were
being caugth and gave a (wrong) hint why it wouldn't work. By using
`python.withPackages` instead of the crafted search path with only the
direct dependencies those missing feature should now be working.

See issue #67094 for details on the observed errors.

Fixes #67094
This commit is contained in:
Andreas Rammhold 2019-09-09 10:44:39 +02:00
parent 5f3d43fedf
commit 4fdbdcede0

@ -13,7 +13,7 @@
let
pythonInputs = [ cffi cryptography pyopenssl crcmod ]
++ lib.optional (with-gce) google-compute-engine;
pythonPath = lib.makeSearchPath python.sitePackages pythonInputs;
pythonEnv = python.withPackages (_: pythonInputs);
baseUrl = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads";
sources = name: system: {
@ -53,8 +53,8 @@ in stdenv.mkDerivation rec {
programPath="$out/google-cloud-sdk/bin/$program"
binaryPath="$out/bin/$program"
wrapProgram "$programPath" \
--set CLOUDSDK_PYTHON "${python}/bin/python" \
--prefix PYTHONPATH : "${pythonPath}"
--set CLOUDSDK_PYTHON "${pythonEnv}/bin/python" \
--prefix PYTHONPATH : "${pythonEnv}/${python.sitePackages}"
mkdir -p $out/bin
ln -s $programPath $binaryPath