From 9413cf3efc429a38c36dd24cd6d11824f2987bdd Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Thu, 16 May 2024 18:46:20 +0000 Subject: [PATCH] apks/chromium/default.nix: Fix a Python version incompatibility Fixes e.g.: python3 ../../tools/grit/grit.py -i ../../chrome/app/generated_resources.grd build -o gen/chrome --depdir . --depfile gen/chrome/app/generated_resources_grit.d --write-only-new=1 --depend-on-stamp -E root_gen_dir=gen -E root_src_dir=../../ -D SHARED_INTERMEDIATE_DIR=gen -D DEVTOOLS_GRD_PATH=gen/third_party/devtools-frontend/src/front_end/devtools_resources -D _chromium -E CHROMIUM_BUILD=chromium -E ANDROID_JAVA_TAGGED_ONLY=true -t android -D enable_arcore=false -D enable_background_mode=false -D enable_background_contents=false -D enable_extensions=false -D enable_hangout_services_extension=false -D enable_plugins=false -D enable_print_preview=false -D enable_printing=true -D enable_service_discovery=false -D enable_side_search=false -D enable_supervised_users=true -D enable_vr=false -D enable_webui_tab_strip=false -D safe_browsing_mode=2 -D optimize_webui=true -D enable_feed_v2=true -D use_nss_certs=false -f gen/tools/gritsettings/default_resource_ids --assert-file-list obj/chrome/app/generated_resources_expected_outputs.txt --allowlist-support --js-minifier ../../tools/grit/minify_with_uglify.py --css-minifier ../../tools/grit/minimize_css.py Traceback (most recent call last): File "/build/chromium-100.0.4896.127-src/src/out/Release/../../tools/grit/grit.py", line 29, in sys.exit(grit.grit_runner.Main(sys.argv[1:])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/chromium-100.0.4896.127-src/src/tools/grit/grit/grit_runner.py", line 314, in Main return toolobject.Run(options, args[1:]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/chromium-100.0.4896.127-src/src/tools/grit/grit/tool/build.py", line 255, in Run self.res = grd_reader.Parse(opts.input, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/chromium-100.0.4896.127-src/src/tools/grit/grit/grd_reader.py", line 231, in Parse handler.root.AssignFirstIds(filename_or_stream, defines) File "/build/chromium-100.0.4896.127-src/src/tools/grit/grit/node/misc.py", line 611, in AssignFirstIds src_root_dir, first_ids = _ReadFirstIdsFromFile(first_ids_filename, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/chromium-100.0.4896.127-src/src/tools/grit/grit/node/misc.py", line 67, in _ReadFirstIdsFromFile first_ids_dict = eval(util.ReadFile(filename, 'utf-8')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/chromium-100.0.4896.127-src/src/tools/grit/grit/util.py", line 214, in ReadFile with io.open(filename, mode, encoding=encoding) as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid mode: 'rU' Unfortunately, it is not enough to allow chromium to build, but it does fix that particular error. --- apks/chromium/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apks/chromium/default.nix b/apks/chromium/default.nix index e8228430..a47f903e 100644 --- a/apks/chromium/default.nix +++ b/apks/chromium/default.nix @@ -2,7 +2,7 @@ # SPDX-License-Identifier: MIT { pkgs, callPackage, stdenv, stdenvNoCC, lib, fetchgit, fetchurl, fetchcipd, runCommand, symlinkJoin, writeScript, buildFHSUserEnv, autoPatchelfHook, buildPackages -, python2, python3, ninja, llvmPackages_11, nodejs, jre8, bison, gperf, pkg-config, protobuf, bsdiff +, python2, python310, ninja, llvmPackages_11, nodejs, jre8, bison, gperf, pkg-config, protobuf, bsdiff , dbus, systemd, glibc, at-spi2-atk, atk, at-spi2-core, nspr, nss, pciutils, util-linux, libkrb5, gdk-pixbuf , glib, gtk3, alsa-lib, pulseaudio, xdg-utils, libXScrnSaver, libXcursor, libXtst, libXdamage , libdrm, libxkbcommon @@ -143,6 +143,8 @@ let ''; }; + python3 = python310; + in stdenvNoCC.mkDerivation rec { pname = name; inherit version src;