Merge pull request #68348 from andir/google-cloud-sdk-pythonenv

Google cloud sdk pythonenv
This commit is contained in:
Andreas Rammhold
2019-09-22 09:15:28 +02:00
committed by GitHub
3 changed files with 11 additions and 12 deletions
@@ -7,13 +7,15 @@
# 3) used by `google-cloud-sdk` only on GCE guests
#
{ stdenv, lib, fetchurl, makeWrapper, python, cffi, cryptography, pyopenssl,
crcmod, google-compute-engine, with-gce ? false }:
{ stdenv, lib, fetchurl, makeWrapper, python, with-gce ? false }:
let
pythonInputs = [ cffi cryptography pyopenssl crcmod ]
++ lib.optional (with-gce) google-compute-engine;
pythonPath = lib.makeSearchPath python.sitePackages pythonInputs;
pythonEnv = python.withPackages (p: with p; [
cffi
cryptography
pyopenssl
crcmod
] ++ lib.optional (with-gce) google-compute-engine);
baseUrl = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads";
sources = name: system: {
@@ -53,8 +55,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