From 08c7b8d6e2788e34dfaeca98589c9eaeaded5b6c Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 22 Jul 2024 10:38:07 -0700 Subject: [PATCH] Prepend third_party/pyyaml to python sys.path (flutter/engine#54023) Previously we were appending Flutter's fork of third_party/pyyaml to the Python sys.path. In the case where a bot image or local install already has pyyaml installed elsewhere on the path, ours will fail to be picked up. Instead prepend to the path. Issue spotted by jsimmons@. Related: https://github.com/flutter/engine/pull/54001 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../src/flutter/tools/fuchsia/dart/gen_dart_package_config.py | 2 +- engine/src/flutter/tools/pub_get_offline.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/tools/fuchsia/dart/gen_dart_package_config.py b/engine/src/flutter/tools/fuchsia/dart/gen_dart_package_config.py index 71a8bb3666..d46ba0f8da 100755 --- a/engine/src/flutter/tools/fuchsia/dart/gen_dart_package_config.py +++ b/engine/src/flutter/tools/fuchsia/dart/gen_dart_package_config.py @@ -15,7 +15,7 @@ import re import sys THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -sys.path += [os.path.join(THIS_DIR, '..', '..', '..', 'third_party', 'pyyaml', 'lib')] +sys.path.insert(0, os.path.join(THIS_DIR, '..', '..', '..', 'third_party', 'pyyaml', 'lib')) import yaml DEFAULT_LANGUAGE_VERSION = '2.8' diff --git a/engine/src/flutter/tools/pub_get_offline.py b/engine/src/flutter/tools/pub_get_offline.py index 56e1d8d0d8..2195a676a7 100644 --- a/engine/src/flutter/tools/pub_get_offline.py +++ b/engine/src/flutter/tools/pub_get_offline.py @@ -15,7 +15,7 @@ import subprocess import sys THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -sys.path += [os.path.join(THIS_DIR, '..', 'third_party', 'pyyaml', 'lib')] +sys.path.insert(0, os.path.join(THIS_DIR, '..', 'third_party', 'pyyaml', 'lib')) import yaml # pylint: disable=import-error, wrong-import-position SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))