Skip to content

Commit

Permalink
bazel: drop absolute Python path
Browse files Browse the repository at this point in the history
Without this Bazel always picks Python 3 which breaks Python 2 packages.
Strangely enough just dropping this patch works, with all `bazel.tests`
passing.
  • Loading branch information
abbradar committed Jul 16, 2019
1 parent 49ca44c commit bd98f35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
11 changes: 4 additions & 7 deletions pkgs/development/tools/build-managers/bazel/default.nix
Expand Up @@ -136,8 +136,6 @@ stdenv.mkDerivation rec {
# This is breaking the build of any C target. This patch removes the last
# argument if it's found to be an empty string.
./trim-last-argument-to-gcc-if-empty.patch

./python-stub-path-fix.patch
] ++ lib.optional enableNixHacks ./nix-hacks.patch;


Expand Down Expand Up @@ -220,13 +218,13 @@ stdenv.mkDerivation rec {
cpp = callPackage ./cpp-test.nix { inherit runLocal bazelTest bazel-examples; };
java = callPackage ./java-test.nix { inherit runLocal bazelTest bazel-examples; };
protobuf = callPackage ./protobuf-test.nix { inherit runLocal bazelTest; };
pythonBinPath = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; };
pythonBinPath = callPackage ./python-bin-path-test.nix { inherit runLocal bazelTest; };

bashToolsWithNixHacks = callPackage ./bash-tools-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
cppWithNixHacks = callPackage ./cpp-test.nix { inherit runLocal bazelTest bazel-examples; bazel = bazelWithNixHacks; };
javaWithNixHacks = callPackage ./java-test.nix { inherit runLocal bazelTest bazel-examples; bazel = bazelWithNixHacks; };
protobufWithNixHacks = callPackage ./protobuf-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
pythonBinPathWithNixHacks = callPackage ./python-bin-path-test.nix{ inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
pythonBinPathWithNixHacks = callPackage ./python-bin-path-test.nix { inherit runLocal bazelTest; bazel = bazelWithNixHacks; };
};

# update the list of workspace dependencies
Expand Down Expand Up @@ -310,9 +308,8 @@ stdenv.mkDerivation rec {
genericPatches = ''
# Substitute python's stub shebang to plain python path. (see TODO add pr URL)
# See also `postFixup` where python is added to $out/nix-support
substituteInPlace src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt\
--replace "/usr/bin/env python" "${python3}/bin/python" \
--replace "NIX_STORE_PYTHON_PATH" "${python3}/bin/python" \
patchShebangs src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt \
--replace "#!/usr/bin/env python" "#!${python3}/bin/python"
# md5sum is part of coreutils
sed -i 's|/sbin/md5|md5sum|' \
Expand Down

This file was deleted.

0 comments on commit bd98f35

Please sign in to comment.