Skip to content

Commit

Permalink
apks/chromium/default.nix: Fix a Python version incompatibility
Browse files Browse the repository at this point in the history
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 <module>
    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.
  • Loading branch information
CyberShadow committed May 18, 2024
1 parent aae5b11 commit 9413cf3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apks/chromium/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -143,6 +143,8 @@ let
'';
};

python3 = python310;

in stdenvNoCC.mkDerivation rec {
pname = name;
inherit version src;
Expand Down

0 comments on commit 9413cf3

Please sign in to comment.