diff --git a/pkgs/tools/admin/google-cloud-sdk/default.nix b/pkgs/tools/admin/google-cloud-sdk/default.nix index 2064022d80c5..87cb27b57d19 100644 --- a/pkgs/tools/admin/google-cloud-sdk/default.nix +++ b/pkgs/tools/admin/google-cloud-sdk/default.nix @@ -43,6 +43,8 @@ in stdenv.mkDerivation rec { ./gcloud-path.patch # Disable checking for updates for the package ./gsutil-disable-updates.patch + # Revert patch including extended Python version constraint + ./gsutil-revert-version-constraint.patch ]; installPhase = '' @@ -120,6 +122,7 @@ in stdenv.mkDerivation rec { # Avoid trying to write logs to homeless-shelter export HOME=$(mktemp -d) $out/bin/gcloud version --format json | jq '."Google Cloud SDK"' | grep "${version}" + $out/bin/gsutil version | grep -w "$(cat platform/gsutil/VERSION)" ''; passthru = { diff --git a/pkgs/tools/admin/google-cloud-sdk/gsutil-revert-version-constraint.patch b/pkgs/tools/admin/google-cloud-sdk/gsutil-revert-version-constraint.patch new file mode 100644 index 000000000000..616e904cae4f --- /dev/null +++ b/pkgs/tools/admin/google-cloud-sdk/gsutil-revert-version-constraint.patch @@ -0,0 +1,21 @@ +diff --git a/platform/gsutil/gsutil.py b/platform/gsutil/gsutil.py +index 30b8a5ac..a02f0ba5 100755 +--- a/platform/gsutil/gsutil.py ++++ b/platform/gsutil/gsutil.py +@@ -27,14 +27,8 @@ import warnings + # TODO: gsutil-beta: Distribute a pylint rc file. + + ver = sys.version_info +-if (ver.major == 2 and ver.minor < 7) or (ver.major == 3 and (ver.minor < 5 or ver.minor > 11)): +- sys.exit( +- "Error: gsutil requires Python version 2.7 or 3.5-3.11, but a different version is installed.\n" +- "You are currently running Python {}.{}\n" +- "Follow the steps below to resolve this issue:\n" +- "\t1. Switch to Python 3.5-3.11 using your Python version manager or install an appropriate version.\n" +- "\t2. If you are unsure how to manage Python versions, visit [https://cloud.google.com/storage/docs/gsutil_install#specifications] for detailed instructions.".format(ver.major, ver.minor) +- ) ++if (ver.major == 2 and ver.minor < 7) or (ver.major == 3 and ver.minor < 5): ++ sys.exit('gsutil requires python 2.7 or 3.5+.') + + # setup a string to load the correct httplib2 + if sys.version_info.major == 2: