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

Method __init__

pex/pex_builder.py:139–177  ·  view source on GitHub ↗

Initialize a pex builder. :keyword path: The path to write the PEX as it is built. If ``None`` is specified, a temporary directory will be created. :keyword interpreter: The interpreter to use to build this PEX environment. If ``None`` is specified, the current

(
        self,
        path=None,  # type: Optional[str]
        interpreter=None,  # type: Optional[PythonInterpreter]
        chroot=None,  # type: Optional[Chroot]
        pex_info=None,  # type: Optional[PexInfo]
        preamble=None,  # type: Optional[str]
        copy_mode=CopyMode.LINK,  # type: CopyMode.Value
    )

Source from the content-addressed store, hash-verified

137 pass
138
139 def __init__(
140 self,
141 path=None, # type: Optional[str]
142 interpreter=None, # type: Optional[PythonInterpreter]
143 chroot=None, # type: Optional[Chroot]
144 pex_info=None, # type: Optional[PexInfo]
145 preamble=None, # type: Optional[str]
146 copy_mode=CopyMode.LINK, # type: CopyMode.Value
147 ):
148 # type: (...) -> None
149 """Initialize a pex builder.
150
151 :keyword path: The path to write the PEX as it is built. If ``None`` is specified,
152 a temporary directory will be created.
153 :keyword interpreter: The interpreter to use to build this PEX environment. If ``None``
154 is specified, the current interpreter is used.
155 :keyword chroot: If specified, preexisting :class:`Chroot` to use for building the PEX.
156 :keyword pex_info: A preexisting PexInfo to use to build the PEX.
157 :keyword preamble: If supplied, execute this code prior to bootstrapping this PEX
158 environment.
159 :keyword copy_mode: Create the pex environment using the given copy mode.
160
161 .. versionchanged:: 0.8
162 The temporary directory created when ``path`` is not specified is now garbage collected on
163 interpreter exit.
164 """
165 self._interpreter = interpreter or PythonInterpreter.get()
166 self._chroot = chroot or Chroot(path or safe_mkdtemp())
167 self._pex_info = pex_info or PexInfo.default()
168 self._preamble = preamble or ""
169 self._copy_mode = (
170 CopyMode.LINK if ((copy_mode is CopyMode.SYMLINK) and WINDOWS) else copy_mode
171 )
172
173 self._shebang = self._interpreter.identity.hashbang()
174 self._header = None # type: Optional[str]
175 self._logger = logging.getLogger(__name__)
176 self._frozen = False
177 self._distributions = {} # type: Dict[str, Distribution]
178
179 def _ensure_unfrozen(self, name="Operation"):
180 if self._frozen:

Callers

nothing calls this directly

Calls 5

ChrootClass · 0.90
safe_mkdtempFunction · 0.90
hashbangMethod · 0.80
getMethod · 0.45
defaultMethod · 0.45

Tested by

no test coverage detected