Exemplo n.º 1
0
 def get_version(self):
     """Get the Version of CMake"""
     child = pexpect.spawn(self.Opts.CMakeBinPath, ["--version"])
     child.expect('cmake version ')
     child.expect(pexpect.EOF)
     child.close()
     result = child.before.split('\n')[0]
     result = result.replace('\r', '')
     self.Version = result
     return self.Version
Exemplo n.º 2
0
 def build(self):
     """Use cmake to start the build process"""
     self.setupworkingdir(self.BuildOpts.BuildDirectory)
     cmdargs = self.BuildOpts.get_opts()
     self.Process = pexpect.spawn(self.BuildOpts.CMakeBinPath, args = cmdargs, cwd = self.BuildOpts.BuildDirectory)
     self.Process.logfile = self.BuildOpts.LogFile
     if self.Process.isalive: self.Process.wait()
     self.Process.expect(pexpect.EOF)
     self.Process.close()
     return
Exemplo n.º 3
0
 def testexe(self):
     """Test the cmake exe"""
     # Test the CMake exe
     child = pexpect.spawn(self.Opts.CMakeBinPath, ["--version"])
     # Log everything to stdout
     child.logfile = sys.stdout
     # Tell pexpect to finish processing
     child.expect(pexpect.EOF)
     child.close()
     result = child.before
     return result
Exemplo n.º 4
0
 def generate(self):
     """Start the running of cmake to generate the build files"""
     self.setupworkingdir(self.Opts.BuildDirectory)
     cmdargs = self.Opts.get_opts()
     self.Process = pexpect.spawn(self.Opts.CMakeBinPath, args = cmdargs, cwd = self.Opts.BuildDirectory)
     self.Process.logfile = self.Opts.LogFile
     if self.Process.isalive: self.Process.wait()
     self.Process.expect(pexpect.EOF)
     self.Process.close()
     
     self.BuildOpts.CMakeBinPath = self.Opts.CMakeBinPath
     self.BuildOpts.BuildDirectory = self.Opts.BuildDirectory
     return
Exemplo n.º 5
0
    def get_generators(self):
        """Get a list of generators"""
        child = pexpect.spawn(self.Opts.CMakeBinPath, ["--help"])
        time.sleep(0.5)
        child.expect('The following generators are available on this platform:')
        child.expect(pexpect.EOF)
        child.close()
        result = child.before.replace('\r', '')
        result = result.split("\n")
        resultlist = list()
        for item in result:
            if item == '': continue
            if "=" in item:
                itemsplit = item.split("=")
                itemsplit[0] = itemsplit[0].replace("[arch]", "").strip()
                itemsplit[1] = itemsplit[1].strip()
                resultlist.append([itemsplit[0],itemsplit[1]])
            else:
                resultlist[-1][1] += "\n" + item.strip()

        self.Generators = resultlist
        return self.Generators