def make_module_req_guess(self):
     """
     Paths to consider for prepend-paths statements in module file
     """
     libdirs = [
         'lib',
         os.path.join('lib', 'x64'),
         os.path.join('compiler', 'lib', 'intel64_lin'),
     ]
     libdirs = [os.path.join(self.compilers_subdir, x) for x in libdirs]
     # resolve 'latest' symlink for tbb (if module guess is run with install in place)
     if os.path.islink(os.path.join(self.installdir, self.tbb_subdir)):
         tbb_version = os.readlink(os.path.join(self.installdir, self.tbb_subdir))
     else:
         tbb_version = 'latest'
     tbb_subdir = os.path.join('tbb', tbb_version)
     tbb_libsubdir = os.path.join(tbb_subdir, 'lib', 'intel64')
     libdirs.append(os.path.join(tbb_libsubdir,
                                 get_tbb_gccprefix(os.path.join(self.installdir, tbb_libsubdir))))
     guesses = {
         'PATH': [
             os.path.join(self.compilers_subdir, 'bin'),
             os.path.join(self.compilers_subdir, 'bin', 'intel64'),
         ],
         'LD_LIBRARY_PATH': libdirs,
         'LIBRARY_PATH': libdirs,
         'OCL_ICD_FILENAMES': [
             os.path.join(self.compilers_subdir, 'lib', 'x64', 'libintelocl.so'),
         ],
         'CPATH': [
             os.path.join(tbb_subdir, 'include'),
         ],
         'TBBROOT': [tbb_subdir],
     }
     return guesses
    def make_module_req_guess(self):
        """
        Additional paths to consider for prepend-paths statements in module file
        """
        prefix = None

        # guesses per environment variables
        # some of these paths only apply to certain versions, but that doesn't really matter
        # existence of paths is checked by module generator before 'prepend-paths' statements are included
        guesses = {
            'CLASSPATH': ['daal/lib/daal.jar'],
            # 'include' is deliberately omitted, including it causes problems, e.g. with complex.h and std::complex
            # cfr. https://software.intel.com/en-us/forums/intel-c-compiler/topic/338378
            'CPATH':
            ['daal/include', 'ipp/include', 'mkl/include', 'tbb/include'],
            'DAALROOT': ['daal'],
            'IDB_HOME': ['bin/intel64'],
            'IPPROOT': ['ipp'],
            'LD_LIBRARY_PATH': ['lib'],
            'LIBRARY_PATH': ['lib'],
            'MANPATH': [
                'debugger/gdb/intel64/share/man', 'man', 'man/common',
                'man/en_US', 'share/man'
            ],
            'PATH': ['bin'],
            'TBBROOT': ['tbb'],
        }

        if self.cfg['m32']:
            # 32-bit toolchain
            guesses['PATH'].extend(['bin/ia32', 'tbb/bin/ia32'])
            # in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
            guesses['LD_LIBRARY_PATH'].append('lib/ia32')

        else:
            # 64-bit toolkit
            guesses['PATH'].extend([
                'bin/intel64',
                'debugger/gdb/intel64/bin',
                'ipp/bin/intel64',
                'mpi/intel64/bin',
                'tbb/bin/emt64',
                'tbb/bin/intel64',
            ])

            # in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
            guesses['LD_LIBRARY_PATH'].extend([
                'compiler/lib/intel64',
                'debugger/ipt/intel64/lib',
                'ipp/lib/intel64',
                'mkl/lib/intel64',
                'mpi/intel64',
                'tbb/lib/intel64/%s' % get_tbb_gccprefix(),
            ])

            if LooseVersion(self.version) < LooseVersion('2016'):
                prefix = 'composer-xe-%s' % self.version

                # debugger is dependent on $INTEL_PYTHONHOME since version 2015 and newer
                if LooseVersion(self.version) >= LooseVersion('2015'):
                    self.debuggerpath = os.path.join(
                        'composer-xe-%s' % self.version.split('.')[0],
                        'debugger')

            else:
                # new directory layout for Intel Parallel Studio XE 2016
                # https://software.intel.com/en-us/articles/new-directory-layout-for-intel-parallel-studio-xe-2016
                prefix = 'compilers_and_libraries_%s/linux' % self.version
                # Debugger requires INTEL_PYTHONHOME, which only allows for a single value
                self.debuggerpath = 'debugger_%s' % self.version.split('.')[0]

                guesses['LD_LIBRARY_PATH'].extend([
                    os.path.join(self.debuggerpath, 'libipt/intel64/lib'),
                    'daal/lib/intel64_lin',
                ])

            # 'lib/intel64' is deliberately listed last, so it gets precedence over subdirs
            guesses['LD_LIBRARY_PATH'].append('lib/intel64')

        guesses['LIBRARY_PATH'] = guesses['LD_LIBRARY_PATH']

        # set debugger path
        if self.debuggerpath:
            guesses['PATH'].append(
                os.path.join(self.debuggerpath, 'gdb', 'intel64', 'bin'))

        # in recent Intel compiler distributions, the actual binaries are
        # in deeper directories, and symlinked in top-level directories
        # however, not all binaries are symlinked (e.g. mcpcom is not)
        if prefix and os.path.isdir(os.path.join(self.installdir, prefix)):
            for key, subdirs in guesses.items():
                guesses[key].extend(
                    [os.path.join(prefix, subdir) for subdir in subdirs])

        return guesses
    def make_module_req_guess(self):
        """
        Additional paths to consider for prepend-paths statements in module file
        """
        prefix = None

        # guesses per environment variables
        # some of these paths only apply to certain versions, but that doesn't really matter
        # existence of paths is checked by module generator before 'prepend-paths' statements are included
        guesses = {
            'CLASSPATH': ['daal/lib/daal.jar'],
            # 'include' is deliberately omitted, including it causes problems, e.g. with complex.h and std::complex
            # cfr. https://software.intel.com/en-us/forums/intel-c-compiler/topic/338378
            'CPATH': ['daal/include', 'ipp/include', 'mkl/include', 'tbb/include'],
            'DAALROOT': ['daal'],
            'IDB_HOME': ['bin/intel64'],
            'IPPROOT': ['ipp'],
            'LD_LIBRARY_PATH': ['lib'],
            'LIBRARY_PATH': ['lib'],
            'MANPATH': ['debugger/gdb/intel64/share/man', 'man', 'man/common', 'man/en_US', 'share/man'],
            'PATH': ['bin'],
            'TBBROOT': ['tbb'],
        }

        if self.cfg['m32']:
            # 32-bit toolchain
            guesses['PATH'].extend(['bin/ia32', 'tbb/bin/ia32'])
            # in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
            guesses['LD_LIBRARY_PATH'].append('lib/ia32')

        else:
            # 64-bit toolkit
            guesses['PATH'].extend([
                'bin/intel64',
                'debugger/gdb/intel64/bin',
                'ipp/bin/intel64',
                'mpi/intel64/bin',
                'tbb/bin/emt64',
                'tbb/bin/intel64',
            ])

            # in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
            guesses['LD_LIBRARY_PATH'].extend([
                'compiler/lib/intel64',
                'debugger/ipt/intel64/lib',
                'ipp/lib/intel64',
                'mkl/lib/intel64',
                'mpi/intel64',
                'tbb/lib/intel64/%s' % get_tbb_gccprefix(),
            ])

            if LooseVersion(self.version) < LooseVersion('2016'):
                prefix = 'composer-xe-%s' % self.version

                # debugger is dependent on $INTEL_PYTHONHOME since version 2015 and newer
                if LooseVersion(self.version) >= LooseVersion('2015'):
                    self.debuggerpath = os.path.join('composer-xe-%s' % self.version.split('.')[0], 'debugger')

            else:
                # new directory layout for Intel Parallel Studio XE 2016
                # https://software.intel.com/en-us/articles/new-directory-layout-for-intel-parallel-studio-xe-2016
                prefix = 'compilers_and_libraries_%s/linux' % self.version
                # Debugger requires INTEL_PYTHONHOME, which only allows for a single value
                self.debuggerpath = 'debugger_%s' % self.version.split('.')[0]

                guesses['LD_LIBRARY_PATH'].extend([
                    os.path.join(self.debuggerpath, 'libipt/intel64/lib'),
                    'daal/lib/intel64_lin',
                ])

            # 'lib/intel64' is deliberately listed last, so it gets precedence over subdirs
            guesses['LD_LIBRARY_PATH'].append('lib/intel64')

        guesses['LIBRARY_PATH'] = guesses['LD_LIBRARY_PATH']

        # set debugger path
        if self.debuggerpath:
            guesses['PATH'].append(os.path.join(self.debuggerpath, 'gdb', 'intel64', 'bin'))

        # in recent Intel compiler distributions, the actual binaries are
        # in deeper directories, and symlinked in top-level directories
        # however, not all binaries are symlinked (e.g. mcpcom is not)
        if prefix and os.path.isdir(os.path.join(self.installdir, prefix)):
            for key, subdirs in guesses.items():
                guesses[key].extend([os.path.join(prefix, subdir) for subdir in subdirs])

        return guesses