MCPcopy Create free account
hub / github.com/pytorch/executorch / __init__

Method __init__

setup.py:303–345  ·  view source on GitHub ↗

Initializes a BuiltFile. Args: src_dir: The directory of the file to install, relative to the cmake-out directory. A placeholder %BUILD_TYPE% will be replaced with the build type for multi-config generators (like Visual Studio) where the build

(
        self,
        src_dir: str,
        src_name: str,
        dst: str,
        dependent_cmake_flags: List[str],
        is_executable: bool = False,
        is_dynamic_lib: bool = False,
    )

Source from the content-addressed store, hash-verified

301 """
302
303 def __init__(
304 self,
305 src_dir: str,
306 src_name: str,
307 dst: str,
308 dependent_cmake_flags: List[str],
309 is_executable: bool = False,
310 is_dynamic_lib: bool = False,
311 ):
312 """Initializes a BuiltFile.
313
314 Args:
315 src_dir: The directory of the file to install, relative to the cmake-out
316 directory. A placeholder %BUILD_TYPE% will be replaced with the build
317 type for multi-config generators (like Visual Studio) where the build
318 output is in a subdirectory named after the build type. For single-
319 config generators (like Makefile Generators or Ninja), this placeholder
320 will be removed.
321 src_name: The name of the file to install
322 dst: The path to install to, relative to the root of the pip
323 package. If dst ends in "/", it is treated as a directory.
324 Otherwise it is treated as a filename.
325 is_executable: If True, the file is an executable. This is used to
326 determine the destination filename for executable.
327 is_dynamic_lib: If True, the file is a dynamic library. This is used
328 to determine the destination filename for dynamic library.
329 """
330 if is_executable and is_dynamic_lib:
331 raise ValueError("is_executable and is_dynamic_lib cannot be both True.")
332 if is_executable:
333 src_name = get_executable_name(src_name)
334 elif is_dynamic_lib:
335 src_name = get_dynamic_lib_name(src_name)
336 src = os.path.join(src_dir, src_name)
337 # This is not a real extension, so use a unique name that doesn't look
338 # like a module path. Some of setuptools's autodiscovery will look for
339 # extension names with prefixes that match certain module paths.
340 super().__init__(
341 src=src,
342 dst=dst,
343 name=f"@EXECUTORCH_BuiltFile_{src}:{dst}",
344 dependent_cmake_flags=dependent_cmake_flags,
345 )
346
347 def dst_path(self, installer: "InstallerBuildExt") -> Path:
348 """Returns the path to the destination file.

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 2

get_executable_nameFunction · 0.85
get_dynamic_lib_nameFunction · 0.85

Tested by

no test coverage detected