Unverified Commit fbe1c368 authored by Robert Schütz's avatar Robert Schütz Committed by GitHub
Browse files

Merge pull request #202800 from dotlambda/bazel-python3

bazel: only use python3
parents 547b3d21 d6ecfa2b
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
, lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, gawk, gnused, gnutar, gnugrep, gzip, findutils
# updater
, python27, python3, writeScript
, python3, writeScript
# Apple dependencies
, cctools, libcxx, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
@@ -406,11 +406,9 @@ stdenv.mkDerivation rec {

    genericPatches = ''
      # Substitute j2objc and objc wrapper's python shebang to plain python path.
      # These scripts explicitly depend on Python 2.7, hence we use python27.
      # See also `postFixup` where python27 is added to $out/nix-support
      substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"
      substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"
      substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"

      # md5sum is part of coreutils
      sed -i 's|/sbin/md5|md5sum|g' \
@@ -424,8 +422,6 @@ stdenv.mkDerivation rec {
      grep -rlZ /bin src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
        # If you add more replacements here, you must change the grep above!
        # Only files containing /bin are taken into account.
        # We default to python3 where possible. See also `postFixup` where
        # python3 is added to $out/nix-support
        substituteInPlace "$path" \
          --replace /bin/bash ${customBash}/bin/bash \
          --replace "/usr/bin/env bash" ${customBash}/bin/bash \
@@ -616,10 +612,6 @@ stdenv.mkDerivation rec {
    echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends
    # The templates get tar’d up into a .jar,
    # so nix can’t detect python is needed in the runtime closure
    # Some of the scripts explicitly depend on Python 2.7. Otherwise, we
    # default to using python3. Therefore, both python27 and python3 are
    # runtime dependencies.
    echo "${python27}" >> $out/nix-support/depends
    echo "${python3}" >> $out/nix-support/depends
    # The string literal specifying the path to the bazel-rc file is sometimes
    # stored non-contiguously in the binary due to gcc optimisations, which leads
+4 −13
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
, lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, gawk, gnused, gnutar, gnugrep, gzip, findutils
# updater
, python27, python3, writeScript
, python3, writeScript
# Apple dependencies
, cctools, libcxx, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
@@ -102,10 +102,6 @@ let
    #            "@bison//:bin/bison",
    #        ],
    #     )
    #
    # Some of the scripts explicitly depend on Python 2.7. Otherwise, we
    # default to using python3. Therefore, both python27 and python3 are
    # runtime dependencies.
    [
      bash
      coreutils
@@ -116,7 +112,6 @@ let
      gnused
      gnutar
      gzip
      python27
      python3
      unzip
      which
@@ -432,11 +427,9 @@ stdenv.mkDerivation rec {

    genericPatches = ''
      # Substitute j2objc and objc wrapper's python shebang to plain python path.
      # These scripts explicitly depend on Python 2.7, hence we use python27.
      # See also `postFixup` where python27 is added to $out/nix-support
      substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"
      substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"
      substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"

      # md5sum is part of coreutils
      sed -i 's|/sbin/md5|md5sum|g' \
@@ -450,8 +443,6 @@ stdenv.mkDerivation rec {
      grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
        # If you add more replacements here, you must change the grep above!
        # Only files containing /bin are taken into account.
        # We default to python3 where possible. See also `postFixup` where
        # python3 is added to $out/nix-support
        substituteInPlace "$path" \
          --replace /bin/bash ${bash}/bin/bash \
          --replace "/usr/bin/env bash" ${bash}/bin/bash \
+5 −14
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
, lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, gawk, gnused, gnutar, gnugrep, gzip, findutils
# updater
, python27, python3, writeScript
, python3, writeScript
# Apple dependencies
, cctools, libcxx, sigtool, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
@@ -100,10 +100,6 @@ let
    #            "@bison//:bin/bison",
    #        ],
    #     )
    #
    # Some of the scripts explicitly depend on Python 2.7. Otherwise, we
    # default to using python3. Therefore, both python27 and python3 are
    # runtime dependencies.
    [
      bash
      coreutils
@@ -114,7 +110,6 @@ let
      gnused
      gnutar
      gzip
      python27
      python3
      unzip
      which
@@ -393,11 +388,9 @@ stdenv.mkDerivation rec {

    genericPatches = ''
      # Substitute j2objc and objc wrapper's python shebang to plain python path.
      # These scripts explicitly depend on Python 2.7, hence we use python27.
      # See also `postFixup` where python27 is added to $out/nix-support
      substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
      substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"
      substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"
      substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}"

      # md5sum is part of coreutils
      sed -i 's|/sbin/md5|md5sum|g' \
@@ -414,8 +407,6 @@ stdenv.mkDerivation rec {
      grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
        # If you add more replacements here, you must change the grep above!
        # Only files containing /bin are taken into account.
        # We default to python3 where possible. See also `postFixup` where
        # python3 is added to $out/nix-support
        substituteInPlace "$path" \
          --replace /bin/bash ${bash}/bin/bash \
          --replace "/usr/bin/env bash" ${bash}/bin/bash \
@@ -426,7 +417,7 @@ stdenv.mkDerivation rec {

      grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do
        substituteInPlace "$path" \
          --replace "/usr/bin/env python2" ${python27}/bin/python \
          --replace "/usr/bin/env python2" ${python3.interpreter} \
          --replace "/usr/bin/env python3" ${python3}/bin/python \
          --replace /usr/bin/env ${coreutils}/bin/env
      done
+2 −9
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
, lr, xe, zip, unzip, bash, writeCBin, coreutils
, which, gawk, gnused, gnutar, gnugrep, gzip, findutils
# updater
, python27, python3, writeScript
, python3, writeScript
# Apple dependencies
, cctools, libcxx, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
@@ -103,10 +103,6 @@ let
    #            "@bison//:bin/bison",
    #        ],
    #     )
    #
    # Some of the scripts explicitly depend on Python 2.7. Otherwise, we
    # default to using python3. Therefore, both python27 and python3 are
    # runtime dependencies.
    [
      bash
      coreutils
@@ -117,7 +113,6 @@ let
      gnused
      gnutar
      gzip
      python27
      python3
      unzip
      which
@@ -414,8 +409,6 @@ stdenv.mkDerivation rec {
      grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
        # If you add more replacements here, you must change the grep above!
        # Only files containing /bin are taken into account.
        # We default to python3 where possible. See also `postFixup` where
        # python3 is added to $out/nix-support
        substituteInPlace "$path" \
          --replace /bin/bash ${bash}/bin/bash \
          --replace "/usr/bin/env bash" ${bash}/bin/bash \
@@ -426,7 +419,7 @@ stdenv.mkDerivation rec {

      grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do
        substituteInPlace "$path" \
          --replace "/usr/bin/env python2" ${python27}/bin/python \
          --replace "/usr/bin/env python2" ${python3.interpreter} \
          --replace "/usr/bin/env python3" ${python3}/bin/python \
          --replace /usr/bin/env ${coreutils}/bin/env
      done