blob: 65dcf3c66de222a58a0e1cee6b0cad3544af6174 [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
Daniel Kutik50a2c0e2022-11-25 13:32:05 +010015import importlib.machinery
16import importlib.util
Conley Owens094cdbe2014-01-30 15:09:59 -080017import os
18
19
20def WrapperPath():
21 return os.path.join(os.path.dirname(__file__), 'repo')
22
David Pursehouse819827a2020-02-12 15:20:19 +090023
Conley Owens094cdbe2014-01-30 15:09:59 -080024_wrapper_module = None
David Pursehouse819827a2020-02-12 15:20:19 +090025
26
Conley Owens094cdbe2014-01-30 15:09:59 -080027def Wrapper():
28 global _wrapper_module
29 if not _wrapper_module:
Daniel Kutik50a2c0e2022-11-25 13:32:05 +010030 modname = 'wrapper'
31 loader = importlib.machinery.SourceFileLoader(modname, WrapperPath())
32 spec = importlib.util.spec_from_loader(modname, loader)
33 _wrapper_module = importlib.util.module_from_spec(spec)
34 loader.exec_module(_wrapper_module)
Conley Owens094cdbe2014-01-30 15:09:59 -080035 return _wrapper_module