Ejemplo n.º 1
0
    def _insert_paths(cls, libraries_path):
        # Display platform details
        p_bits, _ = platform.architecture()
        p_machine = platform.machine()

        log.debug('Bits: %r, Machine: %r', p_bits, p_machine)

        # Retrieve system details
        system = SystemHelper.name()
        architecture = SystemHelper.architecture()

        if not architecture:
            return

        log.debug('System: %r, Architecture: %r', system, architecture)

        # Insert architecture specific libraries
        architectures = [architecture]

        if architecture == 'i686':
            # Fallback to i386
            architectures.append('i386')

        for arch in architectures + ['universal']:
            cls._insert_architecture_paths(libraries_path, system, arch)
Ejemplo n.º 2
0
    def _insert_paths(cls, libraries_path):
        # Display platform details
        p_bits, _ = platform.architecture()
        p_machine = platform.machine()

        log.debug('Bits: %r, Machine: %r', p_bits, p_machine)

        # Retrieve system details
        system = SystemHelper.name()
        architecture = SystemHelper.architecture()

        if not architecture:
            return

        log.debug('System: %r, Architecture: %r', system, architecture)

        # Insert architecture specific libraries
        architectures = [architecture]

        if architecture == 'i686':
            # Fallback to i386
            architectures.append('i386')

        for arch in architectures + ['universal']:
            cls._insert_architecture_paths(libraries_path, system, arch)
Ejemplo n.º 3
0
    def _insert_paths(cls, distribution, libraries_path):
        # Display platform details
        p_bits, _ = platform.architecture()
        p_machine = platform.machine()

        log.debug('Bits: %r, Machine: %r', p_bits, p_machine)

        # Retrieve system details
        system = SystemHelper.name()
        architecture = SystemHelper.architecture()

        if not architecture:
            InterfaceMessages.add(60, 'Unable to retrieve system architecture')
            return False

        log.debug('System: %r, Architecture: %r', system, architecture)

        # Build architecture list
        architectures = [architecture]

        if architecture == 'i686':
            # Fallback to i386
            architectures.append('i386')

        # Insert library paths
        found = False

        for arch in architectures + ['universal']:
            if cls._insert_architecture_paths(libraries_path, system, arch):
                log.debug('Inserted libraries path for system: %r, arch: %r',
                          system, arch)
                found = True

        # Display interface message if no libraries were found
        if not found:
            if distribution and distribution.get('name'):
                message = 'Unable to find compatible native libraries in the %s distribution' % distribution[
                    'name']
            else:
                message = 'Unable to find compatible native libraries'

            InterfaceMessages.add(60, '%s (system: %r, architecture: %r)',
                                  message, system, architecture)

        return found
Ejemplo n.º 4
0
    def get_paths(cache_path):
        """Retrieve system-specific native libraries source + destination path

        :param cache_path: Directory to store cached libraries
        :type cache_path: str

        :rtype: (str, str)
        """
        # Retrieve system details
        system = SystemHelper.name()
        architecture = SystemHelper.architecture()

        if not architecture:
            return None, None

        # Build list of acceptable architectures
        architectures = [architecture]

        if architecture == 'i686':
            # Fallback to i386
            architectures.append('i386')

        # Look for matching libraries
        for arch in architectures + ['universal']:
            # Build source path
            source = os.path.join(CONTENTS_PATH, 'Libraries', system, arch)

            # Ensure `source` directory exists
            if not os.path.exists(source):
                continue

            # Build path for native dependencies
            destination = os.path.join(cache_path, system, arch)

            # Ensure `destination` directory has been created
            if not StorageHelper.create_directories(destination):
                # Directory couldn't be created
                return None, None

            return source, destination

        # No libraries could be found
        log.error('Unable to find native libraries for platform (name: %r, architecture: %r)', system, architecture)
        return None, None
Ejemplo n.º 5
0
    def _insert_paths(cls, distribution, libraries_path):
        # Display platform details
        p_bits, _ = platform.architecture()
        p_machine = platform.machine()

        log.debug('Bits: %r, Machine: %r', p_bits, p_machine)

        # Retrieve system details
        system = SystemHelper.name()
        architecture = SystemHelper.architecture()

        if not architecture:
            InterfaceMessages.add(60, 'Unable to retrieve system architecture')
            return False

        log.debug('System: %r, Architecture: %r', system, architecture)

        # Build architecture list
        architectures = [architecture]

        if architecture == 'i686':
            # Fallback to i386
            architectures.append('i386')

        # Insert library paths
        found = False

        for arch in architectures + ['universal']:
            if cls._insert_architecture_paths(libraries_path, system, arch):
                log.debug('Inserted libraries path for system: %r, arch: %r', system, arch)
                found = True

        # Display interface message if no libraries were found
        if not found:
            if distribution and distribution.get('name'):
                message = 'Unable to find compatible native libraries in the %s distribution' % distribution['name']
            else:
                message = 'Unable to find compatible native libraries'

            InterfaceMessages.add(60, '%s (system: %r, architecture: %r)', message, system, architecture)

        return found