blob: d8823368a021ffc2193837e03e31fc6f61291d90 [file] [log] [blame]
Conley Owens094cdbe2014-01-30 15:09:59 -08001# Copyright (C) 2014 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Mike Frysinger0ab6b112022-12-08 01:46:45 -050015import functools
Daniel Kutik50a2c0e2022-11-25 13:32:05 +010016import importlib.machinery
17import importlib.util
Conley Owens094cdbe2014-01-30 15:09:59 -080018import os
19
20
21def WrapperPath():
Gavin Makea2e3302023-03-11 06:46:20 +000022 return os.path.join(os.path.dirname(__file__), "repo")
Conley Owens094cdbe2014-01-30 15:09:59 -080023
David Pursehouse819827a2020-02-12 15:20:19 +090024
Mike Frysinger0ab6b112022-12-08 01:46:45 -050025@functools.lru_cache(maxsize=None)
Conley Owens094cdbe2014-01-30 15:09:59 -080026def Wrapper():
Gavin Makea2e3302023-03-11 06:46:20 +000027 modname = "wrapper"
28 loader = importlib.machinery.SourceFileLoader(modname, WrapperPath())
29 spec = importlib.util.spec_from_loader(modname, loader)
30 module = importlib.util.module_from_spec(spec)
31 loader.exec_module(module)
32 return module