Beispiel #1
0
    def AutoDetection(self):
        msg = ''

        # Trying to call fastjet-config with which
        result = ShellCommand.Which('fastjet-config', mute=True)
        if len(result) == 0:
            msg = 'The FastJet package is not found.'
            return DetectStatusType.UNFOUND, msg
        islink = os.path.islink(result[0])
        if not islink:
            self.bin_file = os.path.normpath(result[0])
        else:
            self.bin_file = os.path.normpath(os.path.realpath(result[0]))
        self.bin_path = os.path.dirname(self.bin_file)

        # Debug mode
        if self.debug:
            self.logger.debug("  which:         " + str(result[0]) +
                              " [is it a link? " + str(islink) + "]")
            if islink:
                self.logger.debug("                 -> " +
                                  os.path.realpath(result[0]))

        # Which all
        if self.debug:
            result = ShellCommand.Which('fastjet-config', all=True, mute=True)
            if len(result) == 0:
                msg = 'The FastJet package is not found.'
                return DetectStatusType.UNFOUND, msg
            self.logger.debug("  which-all:     ")
            for file in result:
                self.logger.debug("    - " + str(file))
        return DetectStatusType.FOUND, msg
    def ExtractInfo(self):

        # Debug general
        if self.debug:
            self.logger.debug("")
            self.logger.debug("  Python release:         " +
                              str(platform.python_version()))
            self.logger.debug("  Python build:           " +
                              str(platform.python_build()))
            self.logger.debug("  Python compiler:        " +
                              str(platform.python_compiler()))
            self.logger.debug("  Python prefix:          " + str(sys.prefix))
            self.logger.debug("  Python executable used: " +
                              str(sys.executable))

        # Which python
        if self.debug:
            self.logger.debug("  sys.executable:         " +
                              str(sys.executable))
            result = ShellCommand.Which('python', all=False, mute=True)
            if len(result) == 0:
                self.logger.error('python compiler not found. Please install it before ' + \
                                  'using MadAnalysis 5')
                return False
            self.logger.debug("  which:                  " + str(result[0]))

        # Which all
        if self.debug:
            result = ShellCommand.Which('python', all=True, mute=True)
            if len(result) == 0:
                self.logger.error('g++ compiler not found. Please install it before ' + \
                                  'using MadAnalysis 5')
                return False
            self.logger.debug("  which-all:              ")
            for file in result:
                self.logger.debug("    - " + str(file))

        # Python paths
        if self.debug:
            self.logger.debug("  Python internal paths: ")
            tmp = sys.path
            for path in tmp:
                self.logger.debug("    - " + path)
            self.logger.debug("  $PYTHONPATH: ")
            try:
                tmp = os.environ['PYTHONPATH']
            except:
                tmp = []
            if len(tmp) == 0:
                self.logger.debug("    EMPTY OR NOT FOUND")
            else:
                tmp = tmp.split(':')
                for path in tmp:
                    self.logger.debug("    - " + path)
            self.logger.debug("")

        # Ok
        return True
Beispiel #3
0
    def ExtractInfo(self):
        # Which all
        if self.debug:
            result = ShellCommand.Which('make',all=True,mute=True)
            if len(result)==0:
                self.logger.error('GNU Make not found. Please install it before ' + \
                 'using MadAnalysis 5')
                return False
            self.logger.debug("  which-all:     ")
            for file in result:
                self.logger.debug("    - "+str(file))

        # Getting the version
        ok, out, err = ShellCommand.ExecuteWithCapture(['make','--version'],'./')
        if not ok:
            self.logger.error('GNU Make not found. Please install it before ' + \
             'using MadAnalysis 5')
            return False
        lines=out.split('\n')
        if len(lines)==0:
             self.logger.error('command "make --version" seems to not give the GNU Make version')
             return False
        firstline=lines[0]
        firstline=firstline.lstrip()
        firstline=firstline.rstrip()
        self.version = str(firstline)
        if self.debug:
            self.logger.debug("  version:       " + self.version)


        # Ok
        return True
Beispiel #4
0
    def AutoDetection(self):
        # Which
        result = ShellCommand.Which('latex', all=False, mute=True)
        if len(result) == 0:
            return DetectStatusType.UNFOUND, ''
        if self.debug:
            self.logger.debug("  which:         " + str(result[0]))

        # Ok
        return DetectStatusType.FOUND, ''
Beispiel #5
0
    def AutoDetection(self):
        msg = ''

        # Trying to call root-config with which
        result = ShellCommand.Which('root-config')
        if len(result) == 0:
            msg = 'ROOT module called "root-config" is not detected.\n'\
                  +'Two explanations :n'\
                  +' - ROOT is not installed. You can download it '\
                  +'from http://root.cern.ch\n'\
                  +' - ROOT binary folder must be placed in the '\
                  +'global environment variable $PATH'
            return DetectStatusType.UNFOUND, msg
        islink = os.path.islink(result[0])
        if not islink:
            self.bin_file = os.path.normpath(result[0])
        else:
            self.bin_file = os.path.normpath(os.path.realpath(result[0]))
        self.bin_path = os.path.dirname(self.bin_file)

        # Debug mode
        if self.debug:
            self.logger.debug("  which:         " + str(result[0]) +
                              " [is it a link? " + str(islink) + "]")
            if islink:
                self.logger.debug("                 -> " +
                                  os.path.realpath(result[0]))

        # Which all
        if self.debug:
            result = ShellCommand.Which('root-config', all=True, mute=True)
            if len(result) == 0:
                msg = 'ROOT module called "root-config" is not detected.\n'\
                      +'Two explanations :n'\
                      +' - ROOT is not installed. You can download it '\
                      +'from http://root.cern.ch\n'\
                      +' - ROOT binary folder must be placed in the '\
                      +'global environment variable $PATH'
                DetectStatusType.ISSUE, msg
            self.logger.debug("  which-all:     ")
            for file in result:
                self.logger.debug("    - " + str(file))
        return DetectStatusType.FOUND, msg
Beispiel #6
0
    def ExtractInfo(self):
        # Which all
        if self.debug:
            result = ShellCommand.Which('latex', all=True, mute=True)
            if len(result) == 0:
                return False
            self.logger.debug("  which-all:     ")
            for file in result:
                self.logger.debug("    - " + str(file))

        # Ok
        return True
Beispiel #7
0
    def AutoDetection(self):
        msg = ''
        
        # Which
        result = ShellCommand.Which('make',all=False,mute=True)
        if len(result)==0:
            msg = "GNU Make not found. Please install it before using MadAnalysis 5"
            return DetectStatusType.UNFOUND, msg
        if self.debug:
            self.logger.debug("  which:         " + str(result[0]))

        # Ok
        return DetectStatusType.FOUND, msg
Beispiel #8
0
    def ExtractInfo(self):

        # Which all
        if self.debug:
            result = ShellCommand.Which('g++', all=True, mute=True)
            if len(result) == 0:
                self.logger.error('g++ compiler not found. Please install it before ' + \
                 'using MadAnalysis 5')
                return False
            self.logger.debug("  which-all:     ")
            for file in result:
                self.logger.debug("    - " + str(file))

        # Getting the version
        ok, out, err = ShellCommand.ExecuteWithCapture(['g++', '-dumpversion'],
                                                       './')
        if not ok:
            self.logger.error('g++ compiler not found. Please install it before ' + \
             'using MadAnalysis 5')
            return False
        out = out.lstrip()
        out = out.rstrip()
        self.version = str(out)
        if self.debug:
            self.logger.debug("  version:       " + self.version)

        # Getting include path
        ok, out, err = ShellCommand.ExecuteWithCapture(
            ['g++', '-E', '-x', 'c++', '-', '-v'], './', stdin=True)
        if not ok:
            self.logger.warning('unexpected error with g++')
            return True
        toKeep = False
        self.header_paths = []
        self.library_paths = []
        for line in out.split('\n'):
            line = line.lstrip()
            line = line.rstrip()
            if line.startswith('#include <...>'):
                toKeep = True
                continue
            elif line.startswith('End of search list'):
                toKeep = False
            if toKeep:
                if os.path.isdir(line):
                    self.header_paths.append(os.path.normpath(line))
            if line.startswith('LIBRARY_PATH='):
                paths = line[13:].split(':')
                for path in paths:
                    if os.path.isdir(path):
                        self.library_paths.append(os.path.normpath(path))

        if self.debug:
            self.logger.debug("  search path for headers:")
            for line in self.header_paths:
                self.logger.debug('    - ' + line)
            self.logger.debug("  search path for libraries:")
            for line in self.library_paths:
                self.logger.debug('    - ' + line)

        # Ok
        return True