Merge pull request #202800 from dotlambda/bazel-python3

bazel: only use python3

authored by Robert Schütz and committed by GitHub fbe1c368 547b3d21

+15 -48
+4 -12
pkgs/development/tools/build-managers/bazel/bazel_3/default.nix
··· 5 , lr, xe, zip, unzip, bash, writeCBin, coreutils 6 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 7 # updater 8 - , python27, python3, writeScript 9 # Apple dependencies 10 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 11 # Allow to independently override the jdks used to build and run respectively ··· 406 407 genericPatches = '' 408 # Substitute j2objc and objc wrapper's python shebang to plain python path. 409 - # These scripts explicitly depend on Python 2.7, hence we use python27. 410 - # See also `postFixup` where python27 is added to $out/nix-support 411 - substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 412 - substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 413 - substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 414 415 # md5sum is part of coreutils 416 sed -i 's|/sbin/md5|md5sum|g' \ ··· 424 grep -rlZ /bin src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 425 # If you add more replacements here, you must change the grep above! 426 # Only files containing /bin are taken into account. 427 - # We default to python3 where possible. See also `postFixup` where 428 - # python3 is added to $out/nix-support 429 substituteInPlace "$path" \ 430 --replace /bin/bash ${customBash}/bin/bash \ 431 --replace "/usr/bin/env bash" ${customBash}/bin/bash \ ··· 616 echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends 617 # The templates get tar’d up into a .jar, 618 # so nix can’t detect python is needed in the runtime closure 619 - # Some of the scripts explicitly depend on Python 2.7. Otherwise, we 620 - # default to using python3. Therefore, both python27 and python3 are 621 - # runtime dependencies. 622 - echo "${python27}" >> $out/nix-support/depends 623 echo "${python3}" >> $out/nix-support/depends 624 # The string literal specifying the path to the bazel-rc file is sometimes 625 # stored non-contiguously in the binary due to gcc optimisations, which leads
··· 5 , lr, xe, zip, unzip, bash, writeCBin, coreutils 6 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 7 # updater 8 + , python3, writeScript 9 # Apple dependencies 10 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 11 # Allow to independently override the jdks used to build and run respectively ··· 406 407 genericPatches = '' 408 # Substitute j2objc and objc wrapper's python shebang to plain python path. 409 + substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 410 + substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 411 + substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 412 413 # md5sum is part of coreutils 414 sed -i 's|/sbin/md5|md5sum|g' \ ··· 422 grep -rlZ /bin src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 423 # If you add more replacements here, you must change the grep above! 424 # Only files containing /bin are taken into account. 425 substituteInPlace "$path" \ 426 --replace /bin/bash ${customBash}/bin/bash \ 427 --replace "/usr/bin/env bash" ${customBash}/bin/bash \ ··· 612 echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends 613 # The templates get tar’d up into a .jar, 614 # so nix can’t detect python is needed in the runtime closure 615 echo "${python3}" >> $out/nix-support/depends 616 # The string literal specifying the path to the bazel-rc file is sometimes 617 # stored non-contiguously in the binary due to gcc optimisations, which leads
+4 -13
pkgs/development/tools/build-managers/bazel/bazel_4/default.nix
··· 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 # updater 10 - , python27, python3, writeScript 11 # Apple dependencies 12 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 13 # Allow to independently override the jdks used to build and run respectively ··· 102 # "@bison//:bin/bison", 103 # ], 104 # ) 105 - # 106 - # Some of the scripts explicitly depend on Python 2.7. Otherwise, we 107 - # default to using python3. Therefore, both python27 and python3 are 108 - # runtime dependencies. 109 [ 110 bash 111 coreutils ··· 116 gnused 117 gnutar 118 gzip 119 - python27 120 python3 121 unzip 122 which ··· 432 433 genericPatches = '' 434 # Substitute j2objc and objc wrapper's python shebang to plain python path. 435 - # These scripts explicitly depend on Python 2.7, hence we use python27. 436 - # See also `postFixup` where python27 is added to $out/nix-support 437 - substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 438 - substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 439 - substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 440 441 # md5sum is part of coreutils 442 sed -i 's|/sbin/md5|md5sum|g' \ ··· 450 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 451 # If you add more replacements here, you must change the grep above! 452 # Only files containing /bin are taken into account. 453 - # We default to python3 where possible. See also `postFixup` where 454 - # python3 is added to $out/nix-support 455 substituteInPlace "$path" \ 456 --replace /bin/bash ${bash}/bin/bash \ 457 --replace "/usr/bin/env bash" ${bash}/bin/bash \
··· 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 # updater 10 + , python3, writeScript 11 # Apple dependencies 12 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 13 # Allow to independently override the jdks used to build and run respectively ··· 102 # "@bison//:bin/bison", 103 # ], 104 # ) 105 [ 106 bash 107 coreutils ··· 112 gnused 113 gnutar 114 gzip 115 python3 116 unzip 117 which ··· 427 428 genericPatches = '' 429 # Substitute j2objc and objc wrapper's python shebang to plain python path. 430 + substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 431 + substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 432 + substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 433 434 # md5sum is part of coreutils 435 sed -i 's|/sbin/md5|md5sum|g' \ ··· 443 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 444 # If you add more replacements here, you must change the grep above! 445 # Only files containing /bin are taken into account. 446 substituteInPlace "$path" \ 447 --replace /bin/bash ${bash}/bin/bash \ 448 --replace "/usr/bin/env bash" ${bash}/bin/bash \
+5 -14
pkgs/development/tools/build-managers/bazel/bazel_5/default.nix
··· 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 # updater 10 - , python27, python3, writeScript 11 # Apple dependencies 12 , cctools, libcxx, sigtool, CoreFoundation, CoreServices, Foundation 13 # Allow to independently override the jdks used to build and run respectively ··· 100 # "@bison//:bin/bison", 101 # ], 102 # ) 103 - # 104 - # Some of the scripts explicitly depend on Python 2.7. Otherwise, we 105 - # default to using python3. Therefore, both python27 and python3 are 106 - # runtime dependencies. 107 [ 108 bash 109 coreutils ··· 114 gnused 115 gnutar 116 gzip 117 - python27 118 python3 119 unzip 120 which ··· 393 394 genericPatches = '' 395 # Substitute j2objc and objc wrapper's python shebang to plain python path. 396 - # These scripts explicitly depend on Python 2.7, hence we use python27. 397 - # See also `postFixup` where python27 is added to $out/nix-support 398 - substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 399 - substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 400 - substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python" 401 402 # md5sum is part of coreutils 403 sed -i 's|/sbin/md5|md5sum|g' \ ··· 414 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 415 # If you add more replacements here, you must change the grep above! 416 # Only files containing /bin are taken into account. 417 - # We default to python3 where possible. See also `postFixup` where 418 - # python3 is added to $out/nix-support 419 substituteInPlace "$path" \ 420 --replace /bin/bash ${bash}/bin/bash \ 421 --replace "/usr/bin/env bash" ${bash}/bin/bash \ ··· 426 427 grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do 428 substituteInPlace "$path" \ 429 - --replace "/usr/bin/env python2" ${python27}/bin/python \ 430 --replace "/usr/bin/env python3" ${python3}/bin/python \ 431 --replace /usr/bin/env ${coreutils}/bin/env 432 done
··· 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 # updater 10 + , python3, writeScript 11 # Apple dependencies 12 , cctools, libcxx, sigtool, CoreFoundation, CoreServices, Foundation 13 # Allow to independently override the jdks used to build and run respectively ··· 100 # "@bison//:bin/bison", 101 # ], 102 # ) 103 [ 104 bash 105 coreutils ··· 110 gnused 111 gnutar 112 gzip 113 python3 114 unzip 115 which ··· 388 389 genericPatches = '' 390 # Substitute j2objc and objc wrapper's python shebang to plain python path. 391 + substituteInPlace tools/j2objc/j2objc_header_map.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 392 + substituteInPlace tools/j2objc/j2objc_wrapper.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 393 + substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python3.interpreter}" 394 395 # md5sum is part of coreutils 396 sed -i 's|/sbin/md5|md5sum|g' \ ··· 407 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 408 # If you add more replacements here, you must change the grep above! 409 # Only files containing /bin are taken into account. 410 substituteInPlace "$path" \ 411 --replace /bin/bash ${bash}/bin/bash \ 412 --replace "/usr/bin/env bash" ${bash}/bin/bash \ ··· 417 418 grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do 419 substituteInPlace "$path" \ 420 + --replace "/usr/bin/env python2" ${python3.interpreter} \ 421 --replace "/usr/bin/env python3" ${python3}/bin/python \ 422 --replace /usr/bin/env ${coreutils}/bin/env 423 done
+2 -9
pkgs/development/tools/build-managers/bazel/bazel_6/default.nix
··· 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 # updater 10 - , python27, python3, writeScript 11 # Apple dependencies 12 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 13 # Allow to independently override the jdks used to build and run respectively ··· 103 # "@bison//:bin/bison", 104 # ], 105 # ) 106 - # 107 - # Some of the scripts explicitly depend on Python 2.7. Otherwise, we 108 - # default to using python3. Therefore, both python27 and python3 are 109 - # runtime dependencies. 110 [ 111 bash 112 coreutils ··· 117 gnused 118 gnutar 119 gzip 120 - python27 121 python3 122 unzip 123 which ··· 414 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 415 # If you add more replacements here, you must change the grep above! 416 # Only files containing /bin are taken into account. 417 - # We default to python3 where possible. See also `postFixup` where 418 - # python3 is added to $out/nix-support 419 substituteInPlace "$path" \ 420 --replace /bin/bash ${bash}/bin/bash \ 421 --replace "/usr/bin/env bash" ${bash}/bin/bash \ ··· 426 427 grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do 428 substituteInPlace "$path" \ 429 - --replace "/usr/bin/env python2" ${python27}/bin/python \ 430 --replace "/usr/bin/env python3" ${python3}/bin/python \ 431 --replace /usr/bin/env ${coreutils}/bin/env 432 done
··· 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 # updater 10 + , python3, writeScript 11 # Apple dependencies 12 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 13 # Allow to independently override the jdks used to build and run respectively ··· 103 # "@bison//:bin/bison", 104 # ], 105 # ) 106 [ 107 bash 108 coreutils ··· 113 gnused 114 gnutar 115 gzip 116 python3 117 unzip 118 which ··· 409 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 410 # If you add more replacements here, you must change the grep above! 411 # Only files containing /bin are taken into account. 412 substituteInPlace "$path" \ 413 --replace /bin/bash ${bash}/bin/bash \ 414 --replace "/usr/bin/env bash" ${bash}/bin/bash \ ··· 419 420 grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do 421 substituteInPlace "$path" \ 422 + --replace "/usr/bin/env python2" ${python3.interpreter} \ 423 --replace "/usr/bin/env python3" ${python3}/bin/python \ 424 --replace /usr/bin/env ${coreutils}/bin/env 425 done