Ejemplo n.º 1
0
    def _insert_paths_unix(libraries_path, system, architecture):
        # UCS specific libraries
        ucs = UNICODE_MAP.get(sys.maxunicode)
        log.debug('UCS: %r', ucs)

        if ucs:
            PathHelper.insert(libraries_path, system, architecture, ucs)

        # CPU specific libraries
        cpu_type = SystemHelper.cpu_type()
        page_size = SystemHelper.page_size()

        log.debug('CPU Type: %r', cpu_type)
        log.debug('Page Size: %r', page_size)

        if cpu_type:
            PathHelper.insert(libraries_path, system, architecture, cpu_type)

            if page_size:
                PathHelper.insert(libraries_path, system, architecture,
                                  '%s_%s' % (cpu_type, page_size))

        # UCS + CPU specific libraries
        if cpu_type and ucs:
            PathHelper.insert(libraries_path, system, architecture, cpu_type,
                              ucs)

            if page_size:
                PathHelper.insert(libraries_path, system, architecture,
                                  '%s_%s' % (cpu_type, page_size), ucs)
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_unix(libraries_path, system, architecture):
        # UCS specific libraries
        ucs = UNICODE_MAP.get(sys.maxunicode)
        log.debug('UCS: %r', ucs)

        if ucs:
            PathHelper.insert(libraries_path, system, architecture, ucs)

        # CPU specific libraries
        cpu_type = SystemHelper.cpu_type()
        page_size = SystemHelper.page_size()

        log.debug('CPU Type: %r', cpu_type)
        log.debug('Page Size: %r', page_size)

        if cpu_type:
            PathHelper.insert(libraries_path, system, architecture, cpu_type)

            if page_size:
                PathHelper.insert(libraries_path, system, architecture, '%s_%s' % (cpu_type, page_size))

        # UCS + CPU specific libraries
        if cpu_type and ucs:
            PathHelper.insert(libraries_path, system, architecture, cpu_type, ucs)

            if page_size:
                PathHelper.insert(libraries_path, system, architecture, '%s_%s' % (cpu_type, page_size), ucs)

        # Include attributes in error reports
        RAVEN.tags.update({
            'cpu.type': cpu_type,
            'memory.page_size': page_size,
            'python.ucs': ucs
        })
Ejemplo n.º 4
0
    def _insert_paths_unix(libraries_path, system, architecture):
        # UCS specific libraries
        ucs = UNICODE_MAP.get(sys.maxunicode)
        log.debug('UCS: %r', ucs)

        if ucs:
            PathHelper.insert(libraries_path, system, architecture, ucs)

        # CPU specific libraries
        cpu_type = SystemHelper.cpu_type()
        page_size = SystemHelper.page_size()

        log.debug('CPU Type: %r', cpu_type)
        log.debug('Page Size: %r', page_size)

        if cpu_type:
            PathHelper.insert(libraries_path, system, architecture, cpu_type)

            if page_size:
                PathHelper.insert(libraries_path, system, architecture, '%s_%s' % (cpu_type, page_size))

        # UCS + CPU specific libraries
        if cpu_type and ucs:
            PathHelper.insert(libraries_path, system, architecture, cpu_type, ucs)

            if page_size:
                PathHelper.insert(libraries_path, system, architecture, '%s_%s' % (cpu_type, page_size), ucs)
Ejemplo n.º 5
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.º 6
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.º 7
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.º 8
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.º 9
0
    def _insert_paths_windows(libraries_path, system, architecture):
        vcr = SystemHelper.vcr_version() or 'vc12'  # Assume "vc12" if call fails
        ucs = UNICODE_MAP.get(sys.maxunicode)

        log.debug('VCR: %r, UCS: %r', vcr, ucs)

        # VC++ libraries
        PathHelper.insert(libraries_path, system, architecture, vcr)

        # UCS libraries
        if ucs:
            PathHelper.insert(libraries_path, system, architecture, vcr, ucs)
Ejemplo n.º 10
0
    def _insert_paths_windows(libraries_path, system, architecture):
        vcr = SystemHelper.vcr_version(
        ) or 'vc12'  # Assume "vc12" if call fails
        ucs = UNICODE_MAP.get(sys.maxunicode)

        log.debug('VCR: %r, UCS: %r', vcr, ucs)

        # VC++ libraries
        PathHelper.insert(libraries_path, system, architecture, vcr)

        # UCS libraries
        if ucs:
            PathHelper.insert(libraries_path, system, architecture, vcr, ucs)
Ejemplo n.º 11
0
    def _insert_paths_unix(libraries_path, system, architecture):
        # UCS specific libraries
        ucs = UNICODE_MAP.get(sys.maxunicode)
        log.debug('UCS: %r', ucs)

        if ucs:
            PathHelper.insert(libraries_path, system, architecture, ucs)

        # CPU specific libraries
        cpu_type = SystemHelper.cpu_type()
        page_size = SystemHelper.page_size()

        log.debug('CPU Type: %r', cpu_type)
        log.debug('Page Size: %r', page_size)

        if cpu_type:
            PathHelper.insert(libraries_path, system, architecture, cpu_type)

            if page_size:
                PathHelper.insert(libraries_path, system, architecture,
                                  '%s_%s' % (cpu_type, page_size))

        # UCS + CPU specific libraries
        if cpu_type and ucs:
            PathHelper.insert(libraries_path, system, architecture, cpu_type,
                              ucs)

            if page_size:
                PathHelper.insert(libraries_path, system, architecture,
                                  '%s_%s' % (cpu_type, page_size), ucs)

        # Include attributes in error reports
        RAVEN.tags.update({
            'cpu.type': cpu_type,
            'memory.page_size': page_size,
            'python.ucs': ucs
        })
Ejemplo n.º 12
0
    def _insert_paths_windows(libraries_path, system, architecture):
        vcr = SystemHelper.vcr_version(
        ) or 'vc12'  # Assume "vc12" if call fails
        ucs = UNICODE_MAP.get(sys.maxunicode)

        log.debug('VCR: %r, UCS: %r', vcr, ucs)

        # VC++ libraries
        PathHelper.insert(libraries_path, system, architecture, vcr)

        # UCS libraries
        if ucs:
            PathHelper.insert(libraries_path, system, architecture, vcr, ucs)

        # Include attributes in error reports
        RAVEN.tags.update({'python.ucs': ucs, 'vcr.version': vcr})
Ejemplo n.º 13
0
    def _insert_paths_windows(libraries_path, system, architecture):
        vcr = SystemHelper.vcr_version() or 'vc12'  # Assume "vc12" if call fails
        ucs = UNICODE_MAP.get(sys.maxunicode)

        log.debug('VCR: %r, UCS: %r', vcr, ucs)

        # VC++ libraries
        PathHelper.insert(libraries_path, system, architecture, vcr)

        # UCS libraries
        if ucs:
            PathHelper.insert(libraries_path, system, architecture, vcr, ucs)

        # Include attributes in error reports
        RAVEN.tags.update({
            'python.ucs': ucs,
            'vcr.version': vcr
        })