bazel: Full switch to python3

This commit is contained in:
Guillaume Bouchard 2019-06-20 17:20:58 +02:00
parent 7fed6eabcf
commit 27d4ce7ce0

View file

@ -2,7 +2,7 @@
# this package (through the fixpoint glass) # this package (through the fixpoint glass)
, bazel , bazel
, lr, xe, zip, unzip, bash, writeCBin, coreutils , lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, python, gawk, gnused, gnutar, gnugrep, gzip, findutils , which, gawk, gnused, gnutar, gnugrep, gzip, findutils
# updater # updater
, python3, writeScript , python3, writeScript
# Apple dependencies # Apple dependencies
@ -292,8 +292,8 @@ stdenv.mkDerivation rec {
# Substitute python's stub shebang to plain python path. (see TODO add pr URL) # 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 # 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\ substituteInPlace src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt\
--replace "/usr/bin/env python" "${python}/bin/python" \ --replace "/usr/bin/env python" "${python3}/bin/python" \
--replace "NIX_STORE_PYTHON_PATH" "${python}/bin/python" \ --replace "NIX_STORE_PYTHON_PATH" "${python3}/bin/python" \
# md5sum is part of coreutils # md5sum is part of coreutils
sed -i 's|/sbin/md5|md5sum|' \ sed -i 's|/sbin/md5|md5sum|' \
@ -374,15 +374,14 @@ stdenv.mkDerivation rec {
buildInputs = [ buildInputs = [
buildJdk buildJdk
python3 # bazel build requires python3. However we still use python2 for most of the other tasks python3
# This will have to be refactored later.
]; ];
# when a command cant be found in a bazel build, you might also # when a command cant be found in a bazel build, you might also
# need to add it to `defaultShellPath`. # need to add it to `defaultShellPath`.
nativeBuildInputs = [ nativeBuildInputs = [
zip zip
python python3
unzip unzip
makeWrapper makeWrapper
which which
@ -491,7 +490,7 @@ stdenv.mkDerivation rec {
echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends
# The templates get tard up into a .jar, # The templates get tard up into a .jar,
# so nix cant detect python is needed in the runtime closure # so nix cant detect python is needed in the runtime closure
echo "${python}" >> $out/nix-support/depends echo "${python3}" >> $out/nix-support/depends
''; '';
dontStrip = true; dontStrip = true;