Skip to content

Commit

Permalink
google-cloud-sdk: prefer using a pythonEnv vs just a search path
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andir committed Sep 9, 2019
1 parent 5f3d43f commit 4fdbdce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkgs/tools/admin/google-cloud-sdk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4fdbdce

Please sign in to comment.