### macholib.dyld.dyld_executable_path_search Source: https://macholib.readthedocs.io/en/latest/dyld.html Yields paths relative to the executable path if the name starts with '@executable_path/'. ```APIDOC ## macholib.dyld.dyld_executable_path_search ### Description If _name_ is a path starting with `@executable_path/` yield the path relative to the specified _executable_path_. ### Parameters #### Path Parameters - **_name_** (str) - Required - The name of the library or framework. - **_executable_path_** (str) - Optional - The filesystem path of the executable. ``` -------------------------------- ### macholib.dyld.dyld_loader_search Source: https://macholib.readthedocs.io/en/latest/dyld.html Yields paths relative to the loader path if the name starts with '@loader_path/'. ```APIDOC ## macholib.dyld.dyld_loader_search ### Description If _name_ is a path starting with `@loader_path/` yield the path relative to the specified _loader_path_. ### Parameters #### Path Parameters - **_name_** (str) - Required - The name of the library or framework. - **_loader_path_** (str) - Optional - The filesystem path of the object file referencing _name_. ``` -------------------------------- ### dyld_executable_path_search Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Yields paths relative to the specified executable path if the name starts with '@executable_path/'. Yields nothing if executable_path is None. ```APIDOC ## dyld_executable_path_search ### Description If *name* is a path starting with ``@executable_path/`` yield the path relative to the specified *executable_path*. If *executable_path* is None nothing is yielded. ### Parameters #### Query Parameters - **name** (str) - Required - The name of the library or framework to search for, potentially starting with '@executable_path/'. - **executable_path** (str) - Optional - The filesystem path of the executable. ``` -------------------------------- ### dyld_loader_search Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Yields paths relative to the specified loader path if the name starts with '@loader_path/'. Yields nothing if loader_path is None. Added in version 1.6. ```APIDOC ## dyld_loader_search ### Description If *name* is a path starting with ``@loader_path/`` yield the path relative to the specified *loader_path*. If *loader_path* is None nothing is yielded. ### Parameters #### Query Parameters - **name** (str) - Required - The name of the library or framework to search for, potentially starting with '@loader_path/'. - **loader_path** (str) - Optional - The filesystem path for the object file referencing *name*. ### Version Added 1.6 ``` -------------------------------- ### dydl_framework_path() Source: https://macholib.readthedocs.io/en/latest/dyld.html Constructs a framework path. ```APIDOC ## dydl_framework_path(name, path=None) ### Description Constructs a framework path given a framework name and an optional base path. ### Method N/A (Function call) ### Parameters - **name** (string) - The name of the framework. - **path** (string, optional) - The base path to prepend to the framework name. ### Response - **framework_path** (string) - The constructed framework path. ``` -------------------------------- ### Command-line tools usage with python -m macholib Source: https://macholib.readthedocs.io/en/latest/changelog.html Demonstrates how to use the command-line tools 'macho_find', 'macho_dump', and 'macho_standalone' by invoking them through 'python -mmacholib'. This method clarifies which version of the tools is being used. ```bash $ python -mmacholib dump /usr/bin/grep ``` ```bash $ python -mmacholib find ~ ``` ```bash $ python -mmacholib standalone myapp.app ``` -------------------------------- ### Standalone Tool Usage Source: https://macholib.readthedocs.io/en/latest/_sources/changelog.rst.txt Demonstrates how to use the 'standalone' command with macholib to specify the version of tools used for a given application. ```bash $ python -mmacholib standalone myapp.app ``` -------------------------------- ### macholib.dyld.dyld_default_search Source: https://macholib.readthedocs.io/en/latest/dyld.html Yields filesystem locations for dynamic libraries or frameworks using default system linker paths, including `~/Library/Frameworks`. ```APIDOC ## macholib.dyld.dyld_default_search ### Description Yield the filesystem locations to look for a dynamic library or framework using the default locations used by the system dynamic linker. This function will look in `~/Library/Frameworks` for frameworks, even though the system dynamic linker doesn’t. ### Parameters #### Path Parameters - **_name_** (str) - Required - The name of the dynamic library or framework. #### Query Parameters - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### macholib.dyld.dyld_fallback_framework_path Source: https://macholib.readthedocs.io/en/latest/dyld.html Returns a user-specified list of directories for framework fallback search paths. It checks the DYLD_FALLBACK_FRAMEWORK_PATH environment variable. The _env_ argument allows specifying a custom environment dictionary. ```APIDOC ## macholib.dyld.dyld_fallback_framework_path ### Description Return a user specified list of of directories where to look for frameworks that aren’t in their install path, or an empty list when the default fallback path should be used. ### Parameters #### Query Parameters - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### dyld_fallback_framework_path Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Returns a user-specified list of directories for framework fallback search paths or an empty list if the default fallback path should be used. Accepts an optional environment dictionary. ```APIDOC ## dyld_fallback_framework_path ### Description Return a user specified list of of directories where to look for frameworks that aren't in their install path, or an empty list when the default fallback path should be used. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ### See Also - `DYLD_FALLBACK_FRAMEWORK_PATH` in dyld(1) man page. ``` -------------------------------- ### dyld_framework_path Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Returns a user-specified framework search path or an empty list if only the default search path should be used. Accepts an optional environment dictionary. ```APIDOC ## dyld_framework_path ### Description Returns a user-specified framework search path, or an empty list when only the default search path should be used. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ### See Also - `DYLD_FRAMEWORK_PATH` in dyld(1) man page. ``` -------------------------------- ### dyld_default_search Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Yields filesystem locations to look for a dynamic library or framework using the system's default locations. Also checks '~/Library/Frameworks'. Accepts an optional environment dictionary. ```APIDOC ## dyld_default_search ### Description Yield the filesystem locations to look for a dynamic library or framework using the default locations used by the system dynamic linker. This function will look in ``~/Library/Frameworks`` for frameworks, even though the system dynamic linker doesn't. ### Parameters #### Query Parameters - **name** (str) - Required - The name of the dynamic library or framework to search for. - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### Create Standalone Application Bundles Source: https://macholib.readthedocs.io/en/latest/_sources/scripts.rst.txt Convert existing application bundles into standalone versions by embedding all non-system shared libraries and frameworks. This ensures the application runs independently of system library versions. ```bash python -m macholib standalone appbundle... ``` -------------------------------- ### macholib.dyld.dydl_framework_path Source: https://macholib.readthedocs.io/en/latest/dyld.html Returns a user-specified framework search path. It checks the DYLD_FRAMEWORK_PATH environment variable. The _env_ argument allows specifying a custom environment dictionary. ```APIDOC ## macholib.dyld.dydl_framework_path ### Description Returns a user-specified framework search path, or an empty list when only the default search path should be used. ### Parameters #### Query Parameters - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### dyld_fallback_framework_path() Source: https://macholib.readthedocs.io/en/latest/dyld.html Returns the fallback framework search path. ```APIDOC ## dyld_fallback_framework_path() ### Description Returns the fallback framework search path used by dyld. ### Method N/A (Function call) ### Parameters None ### Response - **path_list** (list of strings) - The list of fallback framework paths. ``` -------------------------------- ### Find MachO Binaries Source: https://macholib.readthedocs.io/en/latest/scripts.html Prints the paths of all MachO binaries in the specified directories. Use this to locate MachO files within a given directory structure. ```bash python -mmacholib find dir... ``` -------------------------------- ### macholib.dyld.dyld_fallback_library_path Source: https://macholib.readthedocs.io/en/latest/dyld.html Returns a user-specified list of directories for library fallback search paths. It checks the DYLD_FALLBACK_LIBRARY_PATH environment variable. The _env_ argument allows specifying a custom environment dictionary. ```APIDOC ## macholib.dyld.dyld_fallback_library_path ### Description Return a user specified list of of directories where to look for libraries that aren’t in their install path, or an empty list when the default fallback path should be used. ### Parameters #### Query Parameters - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### macholib.dyld.dyld_override_search Source: https://macholib.readthedocs.io/en/latest/dyld.html Yields filesystem paths for frameworks or libraries based on the provided name and search paths. It considers framework and library search paths. The _env_ argument allows specifying a custom environment dictionary. ```APIDOC ## macholib.dyld.dyld_override_search ### Description If _name_ is a framework name yield filesystem paths relative to the entries in the framework search path. Always yield the filesystem paths relative to the entries in the library search path. ### Parameters #### Path Parameters - **_name_** (str) - Required - The name of the framework or library. #### Query Parameters - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### framework_find() Source: https://macholib.readthedocs.io/en/latest/dyld.html Finds a framework using dyld's search mechanisms. ```APIDOC ## framework_find(name) ### Description Finds a framework with the given name using dyld's search mechanisms. ### Method N/A (Function call) ### Parameters - **name** (string) - The name of the framework to find. ### Response - **found_path** (string or None) - The path to the found framework, or None if not found. ``` -------------------------------- ### Dump Mach-O File Information Source: https://macholib.readthedocs.io/en/latest/_sources/scripts.rst.txt Extract and display detailed information about all architectures within a Mach-O file, including a list of all libraries it links to. This is useful for understanding a binary's dependencies and structure. ```bash python -m macholib dump dir... ``` -------------------------------- ### framework_find Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Finds a framework using system dynamic linker semantics but accepts looser names. Can find frameworks using names like 'Python', 'Python.framework', or 'Python.framework/Versions/Current'. Accepts executable_path and environment arguments. ```APIDOC ## framework_find ### Description Find a framework using the same semantics as the system dynamic linker, but will accept looser names than the system linker. ### Parameters #### Query Parameters - **fn** (str) - Required - The name of the framework to find. - **executable_path** (str) - Optional - The filesystem path of the executable. - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ### Examples This function will return a correct result for input values like: * Python * Python.framework * Python.framework/Versions/Current ``` -------------------------------- ### macholib.dyld.dyld_library_path Source: https://macholib.readthedocs.io/en/latest/dyld.html Returns a user-specified library search path. It checks the DYLD_LIBRARY_PATH environment variable. The _env_ argument allows specifying a custom environment dictionary. ```APIDOC ## macholib.dyld.dyld_library_path ### Description Returns a user-specified library search path, or an empty list when only the default search path should be used. ### Parameters #### Query Parameters - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### dyld_fallback_library_path Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Returns a user-specified list of directories for library fallback search paths or an empty list if the default fallback path should be used. Accepts an optional environment dictionary. ```APIDOC ## dyld_fallback_library_path ### Description Return a user specified list of of directories where to look for libraries that aren't in their install path, or an empty list when the default fallback path should be used. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ### See Also - `DYLD_FALLBACK_LIBRARY_PATH` in dyld(1) man page. ``` -------------------------------- ### dyld_image_suffix Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Looks up and returns the suffix to append to shared library and framework names. Returns None if no suffix should be appended. Accepts an optional environment dictionary. ```APIDOC ## dyld_image_suffix ### Description Looks up the suffix to append to shared library and framework names and returns this value when found. Returns `None` when no suffix should be appended. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ### See Also - `DYLD_IMAGE_SUFFIX` in dyld(1) man page. ``` -------------------------------- ### dyld_library_path() Source: https://macholib.readthedocs.io/en/latest/dyld.html Returns the default library path. ```APIDOC ## dyld_library_path() ### Description Returns the default library path for the current system. ### Method N/A (Function call) ### Parameters None ### Response - **library_path** (string) - The default library path. ``` -------------------------------- ### macholib.MachO.Macho Source: https://macholib.readthedocs.io/en/latest/_sources/MachO.rst.txt Creates a MachO object by reading the Mach-O headers from a specified filename. It supports fat binaries and can optionally raise errors for unknown load commands. ```APIDOC ## MachO(filename, allow_unknown_load_commands=False) ### Description Creates a MachO object by reading the Mach-O headers from *filename*. The *filename* should refer to an existing file in Mach-O format, and can refer to fat (universal) binaries. When *allow_unknown_load_commands* is false, the instance will raise an error when the specified file contains unknown load commands. ### Parameters #### Path Parameters - **filename** (str) - Required - The path to the Mach-O file. - **allow_unknown_load_commands** (bool) - Optional - Defaults to False. If true, allows unknown load commands without raising an error. ``` -------------------------------- ### dyld_library_path Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Returns a user-specified library search path or an empty list if only the default search path should be used. Accepts an optional environment dictionary. ```APIDOC ## dyld_library_path ### Description Returns a user-specified library search path, or an empty list when only the default search path should be used. ### Parameters #### Query Parameters - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ### See Also - `DYLD_LIBRARY_PATH` in dyld(1) man page. ``` -------------------------------- ### macholib.dyld.framework_find Source: https://macholib.readthedocs.io/en/latest/dyld.html Finds a framework using system dynamic linker semantics but accepts looser names. It can resolve names like 'Python', 'Python.framework', or 'Python.framework/Versions/Current'. ```APIDOC ## macholib.dyld.framework_find ### Description Find a framework using the same semantics as the system dynamic linker, but will accept looser names than the system linker. ### Parameters #### Path Parameters - **_fn_** (str) - Required - The name of the framework to find. #### Query Parameters - **_executable_path_** (str) - Optional - The filesystem path of the executable. - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### Extract Framework Information Source: https://macholib.readthedocs.io/en/latest/framework.html Use framework_info() to parse dynamic library names within macOS frameworks. It returns a dictionary with extracted components or None if the name does not match a framework pattern. ```python dict( location='Location', name='Name.framework/Versions/SomeVersion/Name_Suffix', shortname='Name', version='SomeVersion', suffix='Suffix', ) ``` -------------------------------- ### macholib.dyld.dyld_image_suffix Source: https://macholib.readthedocs.io/en/latest/dyld.html Looks up the suffix to append to shared library and framework names. It checks the DYLD_IMAGE_SUFFIX environment variable. The _env_ argument allows specifying a custom environment dictionary. ```APIDOC ## macholib.dyld.dyld_image_suffix ### Description Looks up the suffix to append to shared library and framework names and returns this value when found. Returns `None` when no suffix should be appended. ### Parameters #### Query Parameters - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### dyld_override_search Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Yields filesystem paths relative to framework or library search paths based on the provided name. Accepts an optional environment dictionary. ```APIDOC ## dyld_override_search ### Description If *name* is a framework name yield filesystem paths relative to the entries in the framework search path. Always yield the filesystem paths relative to the entries in the library search path. ### Parameters #### Query Parameters - **name** (str) - Required - The name of the framework or library to search for. - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### Find MachO Binaries Source: https://macholib.readthedocs.io/en/latest/_sources/scripts.rst.txt Use this command to locate all Mach-O binaries within specified directories. It helps in identifying executable files and libraries. ```bash python -m macholib find dir... ``` -------------------------------- ### macholib.framework.framework_info Source: https://macholib.readthedocs.io/en/latest/framework.html Extracts information from a dynamic library name within a macOS framework. It parses various framework naming conventions and returns a dictionary containing details like location, full name, short name, version, and suffix. ```APIDOC ## macholib.framework.framework_info ### Description Extracts useful information from the name of a dynamic library in a framework. It can parse four common framework name formats. ### Function Signature `macholib.framework.framework_info(_filename_)` ### Parameters #### Path Parameters - **_filename_** (string) - Required - The name of the dynamic library file within a framework. ### Returns - `dict` - A mapping containing framework details if the filename matches a known format. The dictionary may include: - `location` (string) - The base location of the framework. - `name` (string) - The full name of the framework file. - `shortname` (string) - The short name of the framework (e.g., 'Name' from 'Name.framework'). - `version` (string) - The version of the framework (e.g., 'SomeVersion'). - `suffix` (string) - Any suffix present in the library name. - `None` - If the filename does not conform to any of the recognized framework name patterns. ### Notes - The `version` and `suffix` components are optional and may be `None` if not present in the filename. ### Example Usage ```python import macholib.framework # Example 1: Framework with version and suffix info1 = macholib.framework.framework_info('Location/MyFramework.framework/Versions/A/MyFramework_Suffix') print(info1) # Expected output: {'location': 'Location', 'name': 'MyFramework.framework/Versions/A/MyFramework_Suffix', 'shortname': 'MyFramework', 'version': 'A', 'suffix': 'Suffix'} # Example 2: Framework with version but no suffix info2 = macholib.framework.framework_info('Location/Another.framework/Versions/1.0/Another') print(info2) # Expected output: {'location': 'Location', 'name': 'Another.framework/Versions/1.0/Another', 'shortname': 'Another', 'version': '1.0', 'suffix': None} # Example 3: Framework without version or suffix info3 = macholib.framework.framework_info('Location/Simple.framework/Simple') print(info3) # Expected output: {'location': 'Location', 'name': 'Simple.framework/Simple', 'shortname': 'Simple', 'version': None, 'suffix': None} # Example 4: Non-framework path info4 = macholib.framework.framework_info('/usr/lib/libSystem.B.dylib') print(info4) # Expected output: None ``` ``` -------------------------------- ### dyld_executable_path_search() Source: https://macholib.readthedocs.io/en/latest/dyld.html Searches for an image relative to the executable's path. ```APIDOC ## dyld_executable_path_search(name, executable_path) ### Description Searches for an image with the given name relative to the provided executable path. ### Method N/A (Function call) ### Parameters - **name** (string) - The name of the image to search for. - **executable_path** (string) - The path to the executable. ### Response - **found_path** (string or None) - The path to the found image, or None if not found. ``` -------------------------------- ### Utility functions Source: https://macholib.readthedocs.io/en/latest/ptypes.html Provides utility functions for working with packable types, including determining size and creating packable types from Python types. ```APIDOC ## Utility functions ### `sizeof(_value_)` Returns the size in bytes of an object when packed, raises `ValueError` for inappropriate values. ### `pypackable(_name_, _pytype_, _format_)` Returns a packable type that is a subclass of the Python type _pytype_. The value is converted to and from the packed format using the struct _format_. ``` -------------------------------- ### Extracting dylib Information Source: https://macholib.readthedocs.io/en/latest/dylib.html Parses a dynamic library filename to extract its location, name, short name, version, and suffix. Returns None if the filename format is not recognized. ```python dict( location='Location', name='Name.SomeVersion_Suffix.dylib', shortname='Name', version='SomeVersion', suffix='Suffix', ) ``` -------------------------------- ### macholib.dyld.dyld_image_suffix_search Source: https://macholib.readthedocs.io/en/latest/dyld.html Yields items from an iterator, prepending the image suffix to names if specified. The _env_ argument allows specifying a custom environment dictionary. ```APIDOC ## macholib.dyld.dyld_image_suffix_search ### Description Yields all items in _iterator_ , and prepents names with the image suffix to those items when the suffix is specified. ### Parameters #### Path Parameters - **_iterator_** (iterator) - Required - The iterator to process. #### Query Parameters - **_env_** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### macholib.MachO.MachO Source: https://macholib.readthedocs.io/en/latest/MachO.html Creates a MachO object by reading the Mach-O headers from a specified filename. It supports reading headers from fat (universal) binaries. An option is available to control error handling for unknown load commands. ```APIDOC ## macholib.MachO.MachO ### Description Creates a MachO object by reading the Mach-O headers from _filename_. The _filename_ should refer to an existing file in Mach-O format, and can refer to fat (universal) binaries. When _allow_unknown_load_commands_ is false the instance will raise an error when the specified file contains unknown load commands. ### Parameters #### Path Parameters - **_filename_** (string) - The path to the Mach-O file. - **_allow_unknown_load_commands_** (boolean) - If false, raises an error when the file contains unknown load commands. Defaults to false. ### Attributes - **commands** (list) - A list of load commands found in the Mach-O header. ``` -------------------------------- ### dyld_find Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Returns the path of the requested dynamic library, raising ValueError if not found. Searches using system dynamic linker semantics. Supports executable_path, environment, and loader_path arguments. Version changed in 1.6 to add loader_path. ```APIDOC ## dyld_find ### Description Returns the path of the requested dynamic library, raises :exc:`ValueError` when the library cannot be found. This function searches for the library in the same locations and de system dynamic linker. ### Parameters #### Query Parameters - **name** (str) - Required - The name of the dynamic library to find. - **executable_path** (str) - Optional - The filesystem path of the executable to which the library is linked. - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. - **loader_path** (str) - Optional - An optional filesystem path for the object file (binary of shared library) that references *name*. ### Raises - **ValueError**: When the library cannot be found. ### Version Changed 1.6: Added the *loader_path* argument. ``` -------------------------------- ### dyld_fallback_library_path() Source: https://macholib.readthedocs.io/en/latest/dyld.html Returns the fallback library search path. ```APIDOC ## dyld_fallback_library_path() ### Description Returns the fallback library search path used by dyld. ### Method N/A (Function call) ### Parameters None ### Response - **path_list** (list of strings) - The list of fallback library paths. ``` -------------------------------- ### Basic Packables Source: https://macholib.readthedocs.io/en/latest/ptypes.html Defines various basic packable types corresponding to common C data types for direct use. ```APIDOC ## Basic packables ### class `macholib.ptypes.p_char`([_value_]) A byte string of length 1 ### class `macholib.ptypes.p_int8` An 8-bit signed integer ### class `macholib.ptypes.p_uint8` An 8-bit unsigned integer ### class `macholib.ptypes.p_int16` An 16-bit signed integer ### class `macholib.ptypes.p_uint16` An 16-bit unsigned integer ### class `macholib.ptypes.p_int32` An 32-bit signed integer ### class `macholib.ptypes.p_uint32` An 32-bit unsigned integer ### class `macholib.ptypes.p_int64` An 64-bit signed integer ### class `macholib.ptypes.p_uint64` An 64-bit unsigned integer ### class `macholib.ptypes.p_float` An floating point value of type `float` ### class `macholib.ptypes.p_double` An floating point value of type `double` ``` -------------------------------- ### macholib.ptypes Utility Functions Source: https://macholib.readthedocs.io/en/latest/_sources/ptypes.rst.txt Provides utility functions for working with packable types, including calculating their size and creating custom packable types. ```APIDOC ## Utility Functions ### `sizeof(value)` Returns the size in bytes of an object when packed. Raises :exc:`ValueError` for inappropriate values. ### `pypackable(name, pytype, format)` Returns a packable type that is a subclass of the Python type *pytype*. The value is converted to and from the packed format using the struct *format*. ``` -------------------------------- ### dyld_image_suffix_search Source: https://macholib.readthedocs.io/en/latest/_sources/dyld.rst.txt Yields all items in an iterator, prepending names with the image suffix when specified. Accepts an optional environment dictionary. ```APIDOC ## dyld_image_suffix_search ### Description Yields all items in *iterator*, and prepents names with the image suffix to those items when the suffix is specified. ### Parameters #### Query Parameters - **iterator** (iterable) - Required - An iterable of names to search. - **env** (dict) - Optional - A dictionary representing the environment, defaults to `os.environ`. ``` -------------------------------- ### dyld_loader_search() Source: https://macholib.readthedocs.io/en/latest/dyld.html Searches for an image using dyld's loader search rules. ```APIDOC ## dyld_loader_search(name) ### Description Searches for an image with the given name using dyld's standard loader search rules. ### Method N/A (Function call) ### Parameters - **name** (string) - The name of the image to search for. ### Response - **found_path** (string or None) - The path to the found image, or None if not found. ``` -------------------------------- ### BasePackable Class Source: https://macholib.readthedocs.io/en/latest/ptypes.html Defines the basic interface for all packable types. It includes methods for constructing values from various sources and serializing them. ```APIDOC ## Packable types ### class `macholib.ptypes.BasePackable` All packable types are a subclass of `BasePackable`, which defines the basic interface but is itself an abstract base class. #### `_endian_` The byteorder of a packed value. This will be `"<"` for little endian values and `">"` for big-endian ones. #### `from_mmap(_mmap_, _ptr_, _**kw_)` This class method constructs the value from a subview of a `mmap.mmap` object. It uses bytes starting at offset _ptr_ and reads just enough bytes to read the entire object. #### `from_fileobj(_fp_, _**kw_)` This class method constructs the value by reading just enough bytes from a file-like object. The file must be opened in binary mode. #### `from_str(_value_, _**kw_)` This class method construct the value by using the struct module to parse the given bytes. The argument to this method is a byte-string, not a unicode-string. #### `from_tuple(_fp_, _**kw_)` This class method constructs the object from a tuple with all fields. #### `to_str()` Returns a byte representation of the value. #### `to_fileobj(_fp_)` Write a byte representation of the value to the given file-like object. The file should be opened in binary mode. #### `to_mmap(_mmap_, _ptr_)` Write the byte representation of the value to a `mmap.mmap` object, starting at offset _ptr_. ``` -------------------------------- ### MachOStandalone Class Source: https://macholib.readthedocs.io/en/latest/MachoOStandalone.html The MachOStandalone class is designed to locate all Mach-O files within a specified directory, assumed to be the root of an application or plugin bundle. It then identifies and copies all non-system dependencies required by these Mach-O files into the bundle, ensuring the application can run as a standalone unit. ```APIDOC ## Class: MachOStandalone ### Description This class locates all Mach-O files in a directory and copies all non-system dependencies for the located files into the bundle, creating a standalone application bundle. ### Parameters * **_base_**: Path to the root directory of the application or plugin bundle. * **_dest_**: Optional. Destination directory for the copied dependencies. * **_graph_**: Optional. A MachOGraph object to use for dependency analysis. * **_env_**: Optional. Environment variables to consider during dependency resolution. * **_executable_path_**: Optional. The path to the main executable file. ``` -------------------------------- ### macholib.dylib.dylib_info Source: https://macholib.readthedocs.io/en/latest/dylib.html Extracts information from a dynamic library name. It parses the library name to identify its location, name, short name, version, and suffix. ```APIDOC ## macholib.dylib.dylib_info ### Description Extracts useful information from the name of a dynamic library. It can parse names in various formats to identify components like location, name, version, and suffix. ### Method `dylib_info(_filename_)` ### Parameters #### Path Parameters - **_filename_** (string) - Required - The name of the dynamic library to parse. ### Returns - **dict** - A mapping containing 'location', 'name', 'shortname', 'version', and 'suffix' if the library name format is recognized. Returns None if the format is not recognized. ### Response Example ```json { "location": "Location", "name": "Name.SomeVersion_Suffix.dylib", "shortname": "Name", "version": "SomeVersion", "suffix": "Suffix" } ``` ### Notes - The `version` and `suffix` components are optional and may be None if not present in the library name. ``` -------------------------------- ### dyld_image_suffix() Source: https://macholib.readthedocs.io/en/latest/dyld.html Returns the default image suffix for the current system. ```APIDOC ## dyld_image_suffix() ### Description Returns the default image suffix for the current system. ### Method N/A (Function call) ### Parameters None ### Response - **suffix** (string) - The default image suffix. ``` -------------------------------- ### dyld_default_search() Source: https://macholib.readthedocs.io/en/latest/dyld.html Performs a default search for an image. ```APIDOC ## dyld_default_search(name) ### Description Performs a default search for an image with the given name. ### Method N/A (Function call) ### Parameters - **name** (string) - The name of the image to search for. ### Response - **found_path** (string or None) - The path to the found image, or None if not found. ``` -------------------------------- ### dyld_override_search() Source: https://macholib.readthedocs.io/en/latest/dyld.html Searches for an image in override paths. ```APIDOC ## dyld_override_search(name, paths) ### Description Searches for an image with the given name within a list of specified override paths. ### Method N/A (Function call) ### Parameters - **name** (string) - The name of the image to search for. - **paths** (list of strings) - A list of directory paths to search within. ### Response - **found_path** (string or None) - The path to the found image, or None if not found. ``` -------------------------------- ### dyld_find() Source: https://macholib.readthedocs.io/en/latest/dyld.html Finds an image using dyld's search mechanisms. ```APIDOC ## dyld_find(name) ### Description Finds an image with the given name using dyld's various search mechanisms. ### Method N/A (Function call) ### Parameters - **name** (string) - The name of the image to find. ### Response - **found_path** (string or None) - The path to the found image, or None if not found. ``` -------------------------------- ### macholib.MachO.lc_str_value Source: https://macholib.readthedocs.io/en/latest/_sources/MachO.rst.txt Returns the bytes for an `lc_str` value. It takes the offset of the `lc_str` value and the `cmd_info` structure containing it as arguments. ```APIDOC ## lc_str_value(offset, cmd_info) ### Description Returns the bytes for an `lc_str` value, given the *offset* of type `lc_str` and the `cmd_info` that contains the structure that contains the `lc_str` value. `cmd_info` is an item in the `commands` attribute of a MachOHeader instance. ### Parameters #### Path Parameters - **offset** (int) - Required - The offset of the `lc_str` value. - **cmd_info** (object) - Required - The `cmd_info` structure containing the `lc_str` value. ``` -------------------------------- ### dyld_image_suffix_search() Source: https://macholib.readthedocs.io/en/latest/dyld.html Searches for an image with a given suffix. ```APIDOC ## dyld_image_suffix_search(name, suffixes) ### Description Searches for an image with a given name and a list of possible suffixes. ### Method N/A (Function call) ### Parameters - **name** (string) - The base name of the image to search for. - **suffixes** (list of strings) - A list of possible image suffixes to try. ### Response - **found_path** (string or None) - The path to the found image, or None if not found. ``` -------------------------------- ### macholib.ptypes Basic Packable Types Source: https://macholib.readthedocs.io/en/latest/_sources/ptypes.rst.txt Defines packable types corresponding to common C basic data types. ```APIDOC ## Basic Packable Types ### `p_char([value])` A byte string of length 1. ### `p_int8` An 8-bit signed integer. ### `p_uint8` An 8-bit unsigned integer. ### `p_int16` A 16-bit signed integer. ### `p_uint16` A 16-bit unsigned integer. ### `p_int32` A 32-bit signed integer. ### `p_uint32` A 32-bit unsigned integer. ### `p_int64` A 64-bit signed integer. ### `p_uint64` A 64-bit unsigned integer. ### `p_float` An floating point value of type ``float``. ### `p_double` An floating point value of type ``double``. **Note:** Types with names starting with ``p_``, such as ``p_int``, are deprecated. ``` -------------------------------- ### macholib.MachO.lc_str_value Source: https://macholib.readthedocs.io/en/latest/MachO.html Returns the bytes for an `lc_str` value. It takes the offset of type `lc_str` and the `cmd_info` which contains the structure holding the `lc_str` value. `cmd_info` is an item from the `commands` attribute of a MachOHeader instance. ```APIDOC ## macholib.MachO.lc_str_value ### Description Returns the bytes for an `lc_str` value, given the offset of type `lc_str` and the `cmd_info` that contains the structure that contains the `lc_str` value. `cmd_info` is and item in the `commands` attribute of a MachOHeader instance. ### Parameters #### Path Parameters - **_offset_** (int) - Description of the offset of type `lc_str` - **_cmd_info_** (object) - The `cmd_info` that contains the structure that contains the `lc_str` value. This is an item in the `commands` attribute of a MachOHeader instance. ### Returns - bytes - The bytes for the `lc_str` value. ``` -------------------------------- ### Structure Class Source: https://macholib.readthedocs.io/en/latest/ptypes.html Represents structured data types composed of multiple fields, where each field is a packable type. ```APIDOC ### class `macholib.ptypes.Structure` #### `_fields_` This class attribute is a list that contains the fields of the structure in the right order. Every item of this list is a tuple with 2 arguments: the first element is the name of the field, and the second the packable type for the field. Every subclass of `Structure` must define __fields__ to be usefull, and the value of __fields__ should not be changed after class construction. ``` -------------------------------- ### macholib.ptypes BasePackable Class Source: https://macholib.readthedocs.io/en/latest/_sources/ptypes.rst.txt The base class for all packable types, defining the fundamental interface for serialization and deserialization. ```APIDOC ## BasePackable Class ### `BasePackable` All packable types are subclasses of :class:`BasePackable`. It defines the basic interface but is an abstract base class. #### Attributes - `_endian_` (string): The byteorder of a packed value. ``'<'`` for little endian, ``'>'`` for big-endian. This is a public value to support both endianness formats. #### Class Methods - `from_mmap(mmap, ptr, **kw)`: Constructs the value from a subview of a :class:`mmap.mmap` object, starting at offset *ptr*. - `from_fileobj(fp, **kw)`: Constructs the value by reading from a file-like object opened in binary mode. - `from_str(value, **kw)`: Constructs the value by parsing the given byte-string using the struct module. - `from_tuple(fp, **kw)`: Constructs the object from a tuple with all fields. #### Methods - `to_str()`: Returns a byte representation of the value. (No default implementation). - `to_fileobj(fp)`: Writes a byte representation of the value to a file-like object opened in binary mode. - `to_mmap(mmap, ptr)`: Writes the byte representation of the value to a :class:`mmap.mmap` object, starting at offset *ptr*. ``` -------------------------------- ### macholib.ptypes Structure Class Source: https://macholib.readthedocs.io/en/latest/_sources/ptypes.rst.txt A class for defining structured data types composed of multiple fields, each with its own packable type. ```APIDOC ## Structure Class ### `Structure(...)` Represents a structured data type. #### Attributes - `_fields_` (list): A list containing the fields of the structure in order. Each item is a tuple: `(field_name, packable_type)`. Subclasses must define this attribute. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.