Esempio n. 1
0
 def clone(self):
     """
 Clones opponent's source code from Github.
 """
     print Colors.OKBLUE + Colors.BOLD + 'CLONING \t ' + self.name + Colors.ENDC
     ps = Process(['git', 'clone', self.repo_url, self.clone_path],
                  TIMEOUT_GIT)
     ps.Run()
     return ps.output()
Esempio n. 2
0
 def pull(self):
     """
 Pulls updates from Github.
 """
     print Colors.OKBLUE + Colors.BOLD + 'PULLING \t ' + self.name + Colors.ENDC
     os.chdir(self.clone_path)
     ps = Process(['git', 'pull'], TIMEOUT_GIT)
     ps.Run()
     os.chdir(self.root_path)
     return ps.output()
Esempio n. 3
0
 def fetch(self):
     """
 Fetches updates from Github.
 """
     print Colors.OKBLUE + Colors.BOLD + 'FETCHING \t ' + self.name + Colors.ENDC
     os.chdir(self.clone_path)
     ps = Process(['git', 'fetch'], TIMEOUT_GIT)
     ps.Run()
     os.chdir(self.root_path)
     return ps.output()
Esempio n. 4
0
 def build(self):
     """
 Executes opponent's Makefile to build an executable.
 """
     print Colors.OKBLUE + Colors.BOLD + 'BUILDING \t ' + self.name + Colors.ENDC
     os.chdir(self.clone_path)
     ps = Process(['make'], TIMEOUT_GIT)
     ps.Run()
     os.chdir(self.root_path)
     return ps.output()
Esempio n. 5
0
    def run(self, input_path):
        """
    Executes opponent's SAT Solver with specified input path. If the executable
    does not exist, an error message is returned.

    input_path -- the text file to run thru SAT Solver
    """
        print Colors.OKBLUE + Colors.BOLD + 'RUNNING \t ' + self.name + Colors.ENDC
        executable = self.clone_path + self.exe_path
        if os.path.isfile(executable):
            ps = Process([self.clone_path + self.exe_path, input_path],
                         self.timeout)
            ps.Run()
            return ps.output().split('\n')[0]
        else:
            return 'EXECUTABLE NOT FOUND\n'