MCPcopy
hub / github.com/pex-tool/pex / locate

Method locate

pex/bootstrap.py:23–40  ·  view source on GitHub ↗

Locates the active PEX bootstrap. :rtype: :class:`Bootstrap`

(cls)

Source from the content-addressed store, hash-verified

21
22 @classmethod
23 def locate(cls):
24 # type: () -> Bootstrap
25 """Locates the active PEX bootstrap.
26
27 :rtype: :class:`Bootstrap`
28 """
29 if cls._INSTANCE is None:
30 bootstrap_path = __file__
31 module_import_path = __name__.split(".")
32
33 # For example, our __file__ might be requests.pex/.bootstrap/pex/bootstrap.pyc and our import
34 # path pex.bootstrap; so we walk back through all the module components of our import path to
35 # find the base sys.path entry where we were found (requests.pex/.bootstrap in this example).
36 for _ in module_import_path:
37 bootstrap_path = os.path.dirname(bootstrap_path)
38
39 cls._INSTANCE = cls(sys_path_entry=bootstrap_path)
40 return cls._INSTANCE
41
42 def __init__(self, sys_path_entry):
43 # type: (str) -> None

Callers 2

for_pexMethod · 0.80
demoteFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected