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
This commit is contained in:
Chris Bracken
2024-07-22 10:38:07 -07:00
committed by GitHub
parent 3a10aabff9
commit 08c7b8d6e2
2 changed files with 2 additions and 2 deletions

View File

@@ -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'

View File

@@ -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__))))