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 5 , lr, xe, zip, unzip, bash, writeCBin, coreutils 6 6 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 7 7 # updater 8 - , python27, python3, writeScript 8 + , python3, writeScript 9 9 # Apple dependencies 10 10 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 11 11 # Allow to independently override the jdks used to build and run respectively ··· 406 406 407 407 genericPatches = '' 408 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" 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}" 414 412 415 413 # md5sum is part of coreutils 416 414 sed -i 's|/sbin/md5|md5sum|g' \ ··· 424 422 grep -rlZ /bin src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 425 423 # If you add more replacements here, you must change the grep above! 426 424 # 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 425 substituteInPlace "$path" \ 430 426 --replace /bin/bash ${customBash}/bin/bash \ 431 427 --replace "/usr/bin/env bash" ${customBash}/bin/bash \ ··· 616 612 echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends 617 613 # The templates get tar’d up into a .jar, 618 614 # 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 615 echo "${python3}" >> $out/nix-support/depends 624 616 # The string literal specifying the path to the bazel-rc file is sometimes 625 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 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 9 # updater 10 - , python27, python3, writeScript 10 + , python3, writeScript 11 11 # Apple dependencies 12 12 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 13 13 # Allow to independently override the jdks used to build and run respectively ··· 102 102 # "@bison//:bin/bison", 103 103 # ], 104 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 105 [ 110 106 bash 111 107 coreutils ··· 116 112 gnused 117 113 gnutar 118 114 gzip 119 - python27 120 115 python3 121 116 unzip 122 117 which ··· 432 427 433 428 genericPatches = '' 434 429 # 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" 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}" 440 433 441 434 # md5sum is part of coreutils 442 435 sed -i 's|/sbin/md5|md5sum|g' \ ··· 450 443 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 451 444 # If you add more replacements here, you must change the grep above! 452 445 # 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 446 substituteInPlace "$path" \ 456 447 --replace /bin/bash ${bash}/bin/bash \ 457 448 --replace "/usr/bin/env bash" ${bash}/bin/bash \
+5 -14
pkgs/development/tools/build-managers/bazel/bazel_5/default.nix
··· 7 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 9 # updater 10 - , python27, python3, writeScript 10 + , python3, writeScript 11 11 # Apple dependencies 12 12 , cctools, libcxx, sigtool, CoreFoundation, CoreServices, Foundation 13 13 # Allow to independently override the jdks used to build and run respectively ··· 100 100 # "@bison//:bin/bison", 101 101 # ], 102 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 103 [ 108 104 bash 109 105 coreutils ··· 114 110 gnused 115 111 gnutar 116 112 gzip 117 - python27 118 113 python3 119 114 unzip 120 115 which ··· 393 388 394 389 genericPatches = '' 395 390 # 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" 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}" 401 394 402 395 # md5sum is part of coreutils 403 396 sed -i 's|/sbin/md5|md5sum|g' \ ··· 414 407 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 415 408 # If you add more replacements here, you must change the grep above! 416 409 # 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 410 substituteInPlace "$path" \ 420 411 --replace /bin/bash ${bash}/bin/bash \ 421 412 --replace "/usr/bin/env bash" ${bash}/bin/bash \ ··· 426 417 427 418 grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do 428 419 substituteInPlace "$path" \ 429 - --replace "/usr/bin/env python2" ${python27}/bin/python \ 420 + --replace "/usr/bin/env python2" ${python3.interpreter} \ 430 421 --replace "/usr/bin/env python3" ${python3}/bin/python \ 431 422 --replace /usr/bin/env ${coreutils}/bin/env 432 423 done
+2 -9
pkgs/development/tools/build-managers/bazel/bazel_6/default.nix
··· 7 7 , lr, xe, zip, unzip, bash, writeCBin, coreutils 8 8 , which, gawk, gnused, gnutar, gnugrep, gzip, findutils 9 9 # updater 10 - , python27, python3, writeScript 10 + , python3, writeScript 11 11 # Apple dependencies 12 12 , cctools, libcxx, CoreFoundation, CoreServices, Foundation 13 13 # Allow to independently override the jdks used to build and run respectively ··· 103 103 # "@bison//:bin/bison", 104 104 # ], 105 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 106 [ 111 107 bash 112 108 coreutils ··· 117 113 gnused 118 114 gnutar 119 115 gzip 120 - python27 121 116 python3 122 117 unzip 123 118 which ··· 414 409 grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do 415 410 # If you add more replacements here, you must change the grep above! 416 411 # 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 412 substituteInPlace "$path" \ 420 413 --replace /bin/bash ${bash}/bin/bash \ 421 414 --replace "/usr/bin/env bash" ${bash}/bin/bash \ ··· 426 419 427 420 grep -rlZ /bin/ tools/python | while IFS="" read -r -d "" path; do 428 421 substituteInPlace "$path" \ 429 - --replace "/usr/bin/env python2" ${python27}/bin/python \ 422 + --replace "/usr/bin/env python2" ${python3.interpreter} \ 430 423 --replace "/usr/bin/env python3" ${python3}/bin/python \ 431 424 --replace /usr/bin/env ${coreutils}/bin/env 432 425 done