Beispiel #1
0
 def CheckState(self):
     """ Check if downloaded and installed."""
     # First test if globally installed, requires at least 2.8.1
     if PackageUtil.FindLibrary(self._Name) is not None:
         # Now check the version
         versionString = PackageUtil.ExecuteSimpleCommand(
             "cmake", ["--version"], None, os.getcwd()).split()[2]
         versionNumbers = versionString.split(".")
         if len(versionNumbers) == 2:  #Patched version
             if int(versionNumbers[0]) >= 2 and int(
                     versionNumbers[1][0]
             ) >= 9:  # Issues with this long term, e.g. cmake 3 or 2.10
                 # Installed is correct version
                 self._SetMode(2)
                 return
         elif len(versionNumbers) == 3:  #Base version
             if int(versionNumbers[0]) >= 2 and int(
                     versionNumbers[1]
             ) >= 8 and int(
                     versionNumbers[2]
             ) >= 1:  # Issues with this long term, e.g. cmake 3 or 2.10
                 # Installed is correct version
                 self._SetMode(2)
                 return
     self._InstallPath = os.path.join(PackageUtil.kInstallPath, self._Name)
     # If here then must manually install
     if os.path.exists(
             os.path.join(PackageUtil.kCachePath, "cmake-2.8.8.tar.gz")):
         self._SetMode(1)  # Downloaded
     if os.path.exists(os.path.join(self.GetInstallPath(), "bin/cmake")):
         self._SetMode(2)  # Installed as well
     return
Beispiel #2
0
 def CheckState( self ):
     """ Check the python-dev install state."""
     # First check for python config
     if PackageUtil.FindLibrary( "python-config" ) is not None:
         # Now can test for linking
         installed, self._CheckPipe = PackageUtil.TestConfigLibrary( "python-config", "Python.h" )
         self._Installed = installed
     return
Beispiel #3
0
def CheckSystem():
    """ Check for G4 in the environment and check if mac."""
    # Check the environment is clean
    env = os.environ
    for envbit in env: #check clean environment
        inenv = env[envbit].find('G4')
        if inenv!=-1:
            Log.Error( "G4... environment variables are present, please run in a clean environment." )
            sys.exit(1)
    # Check g++ is installed (python and g++ are the only prerequisites)
    if PackageUtil.FindLibrary( "g++" ) is None:
        Log.Error( "g++ must be installed for snoing to work, try installing build essentials or xcode." )
        sys.exit(1)
    system =  os.uname()[0]
    if system == 'Darwin':
        PackageUtil.kMac = True
        #Check which environments exist
        if "LIBRARY_PATH" not in os.environ:
            os.environ["LIBRARY_PATH"]=""
        if "CPLUS_INCLUDE_PATH" not in os.environ:
            os.environ["CPLUS_INCLUDE_PATH"]=""
        #Append fink or macports directories, if not already appended
        try:
            finkLoc = PackageUtil.ExecuteSimpleCommand("which",["fink"],None,os.getcwd())
        except Exceptions.PackageException:
            finkLoc = None
        try:
            portLoc = PackageUtil.ExecuteSimpleCommand("which",["port"],None,os.getcwd())
        except Exceptions.PackageException:    
            portLoc = None
        finkDir = None
        if finkLoc!="" and portLoc!="":
            Log.Warn("Both fink and macports installed, going with fink in dir: %s"%finkLoc)
        if finkLoc!="":
            finkDir = finkLoc.strip().replace("/bin/fink","")
        elif portLoc!="":
            finkDir = portLoc.strip().replace("/bin/port","")
        if finkDir is not None:
            os.environ["PATH"]="%s:%s"%(os.path.join(finkDir,"bin"),os.environ["PATH"])
            os.environ["LIBRARY_PATH"]="%s:%s"%(os.path.join(finkDir,"lib"),os.environ["LIBRARY_PATH"])
            os.environ["CPLUS_INCLUDE_PATH"]="%s:%s"%(os.path.join(finkDir,"include"),os.environ["CPLUS_INCLUDE_PATH"])
        #XCode in 10.7 installs X11 to /usr/X11
        if os.path.exists("/usr/X11"):
            os.environ["PATH"] = "/usr/X11/bin:%s" % os.environ["PATH"]
            os.environ["LIBRARY_PATH"] = "/usr/X11/lib:%s" % os.environ["LIBRARY_PATH"]
            os.environ["CPLUS_INCLUDE_PATH"] = "/usr/X11/include:%s" % os.environ["CPLUS_INCLUDE_PATH"]
        #Frameworks
        if os.path.exists("/System/Library/Frameworks"):
            os.environ["CPLUS_INCLUDE_PATH"] = "/System/Library/Frameworks:%s" % os.environ["CPLUS_INCLUDE_PATH"]
    else:
        PackageUtil.kMac = False
Beispiel #4
0
 def CheckState( self ):
     """ For a command package, merely need to test if the command exists."""
     if PackageUtil.FindLibrary( self._Name ) is not None:
         self._Installed = True
     return