26 lines
898 B
Python
26 lines
898 B
Python
# Copyright 2022 Google LLC. All Rights Reserved. This file and proprietary
|
|
# source code may only be used and distributed under the Widevine License
|
|
# Agreement.
|
|
|
|
import os
|
|
import sys
|
|
|
|
CDM_TOP_PATH = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
def LoadPlatform(name):
|
|
"""Loads and returns variables from the given platform."""
|
|
# Don't use "import" since we don't want the module cached since they all have
|
|
# the same base name. This ensures we can load different platforms.
|
|
path = os.path.join(CDM_TOP_PATH, 'platforms', name, 'environment.py')
|
|
if sys.version_info.major == 2:
|
|
# Need to support Python2 for Cobalt
|
|
import imp
|
|
env = imp.load_source('environment', path)
|
|
else:
|
|
import importlib.util
|
|
spec = importlib.util.spec_from_file_location('environment', path)
|
|
env = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(env)
|
|
return vars(env)
|