[3xH] Migrate apply.sh to python 3.12

See https://docs.python.org/dev/whatsnew/3.12.html#imp

Fixes: https://github.com/dart-lang/sdk/issues/55973
Change-Id: I0ac6e60104bddc17cfe5cd537a409c4ded3eb1a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371302
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This commit is contained in:
Alexander Thomas 2024-06-14 06:52:12 +00:00 committed by Commit Queue
parent 18ffc284c3
commit ff3f629d4b

View file

@ -35,7 +35,19 @@ if [ $need_runhooks = true ]; then
# referencing.
# Normally gclient sync would update the cache - but we are bypassing
# it here.
git_cache=$(python3 -c 'import imp; config = imp.load_source("config", ".gclient"); print(getattr(config, "cache_dir", ""))')
git_cache=$(python3 -c '\
import importlib.util
import importlib.machinery
def load_source(modname, filename):
loader = importlib.machinery.SourceFileLoader(modname, filename)
spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
module = importlib.util.module_from_spec(spec)
loader.exec_module(module)
return module
config = load_source("config", ".gclient");
print(getattr(config, "cache_dir", ""))')
# DEPS file might have been patched with new version of packages that
# Dart SDK depends on. Get information about dependencies from the