Esempio n. 1
0
def symlink_dependencies(self, dependencies, dependency_source_location_nodes,
                         executable_dest_path):
    """ Creates a smybolic link dependencies.
    
    If the package is being built for a release configuration or the platform does not support symbolic links a copy will be made of the library.

    :param dependencies: Dependencies to link/copy to executable_dest_path
    :type dependencies: list of strings
    :param dependency_source_location_nodes: Source locations to find dependencies
    :type destination: List of Node objects 
    :param executable_dest_path: Path where the executable/dependencies should be placed
    :type executable_dest_path: String 
    """

    if not isinstance(dependency_source_location_nodes, list):
        dependency_source_location_nodes = [dependency_source_location_nodes]

    Logs.debug('package: linking module dependencies {}'.format(dependencies))

    lib_prefix = get_platform_lib_prefix(self)
    lib_extension = get_dynamic_lib_extension(self)

    for dependency in dependencies:
        depend_node = []
        source_node = None
        for source_location in dependency_source_location_nodes:
            depend_node = source_location.ant_glob(lib_prefix + dependency +
                                                   lib_extension,
                                                   ignorecase=True)
            if depend_node and len(depend_node) > 0:
                source_node = source_location
                break

            elif 'AWS' in dependency:
                # AWS libraries in use/use_lib use _ to separate the name,
                # but the actual library uses '-'. Transform the name and try
                # the glob again to see if we pick up the dependent library
                Logs.debug(
                    'package: Processing AWS lib so changing name to lib*{}*.dylib'
                    .format(dependency.replace('_', '-')))
                depend_node = source_location.ant_glob(
                    "lib*" + dependency.replace('_', '-') + "*.dylib",
                    ignorecase=True)
                if depend_node and len(depend_node) > 0:
                    source_node = source_location
                    break

        if len(depend_node) > 0:
            Logs.debug('package: found dependency {} in {}'.format(
                depend_node, source_node.abspath(), depend_node))
            self.create_symlink_or_copy(depend_node[0],
                                        executable_dest_path,
                                        postpone=False)
        else:
            Logs.debug(
                'package: Could not find the dependency {}. It may be a static library, in which case this can be ignored, or a directory that contains dependencies is missing'
                .format(dependency))
Esempio n. 2
0
def symlink_libraries(self, source, destination): 
    """ Creates a smybolic link for libraries.
    
    An ant_glob is executed on the source node using "*" + result of get_dynamic_lib_extension to determine all the libraries that need to be linked into the destination. If the package is being built for a release configuration or the platform does not support symbolic links a copy will be made of the library.

    :param source: Source of the libraries
    :type source: waflib.Node
    :param destination: Location/path to create the link (or copy) of any libraries found in Source
    :type destination: String 
    """

    lib_extension = get_dynamic_lib_extension(self)
    Logs.debug("package: Copying files with pattern {} from {} to {}".format("*"+lib_extension, source.abspath(), destination))
    lib_files = source.ant_glob("*" + lib_extension)
    for lib in lib_files:
        self.create_symlink_or_copy(lib, destination, postpone=False)