def compmake_console(): ''' Runs the compmake console. Ignore if we are embedded. ''' if compmake_status != compmake_status_embedded: return set_compmake_status(compmake_status_interactive) # we assume that we are done with defining jobs from compmake.ui.ui import clean_other_jobs clean_other_jobs() from compmake.ui.console import interactive_console interactive_console() set_compmake_status(compmake_status_embedded)
def batch_command(s): ''' executes one command ''' # ignore if interactive # we assume that we are done with defining jobs from compmake.ui.ui import clean_other_jobs clean_other_jobs() if compmake_status == compmake_status_interactive: return from compmake.ui.ui import interpret_commands try: return interpret_commands(s) except KeyboardInterrupt: pass
def test_dynamic6(self): # first define with job and run mockup6(self.cc, both=True) db = self.db self.assertRaises(CompmakeBug, jobs_defined, job_id='hd', db=db) self.assert_cmd_success('make recurse=1') check_job_cache_state(job_id='hd', states=[Cache.DONE], db=db) self.assertEqual(jobs_defined(job_id='hd', db=db), set(['hd-id'])) # self.assert_cmd_success('graph compact=0 color=0 ' # 'cluster=1 filter=dot') self.assertJobsEqual('all', ['fd', 'fd-gd', 'fd-gd-g2', 'hd', 'hd-id', 'hd-id-i2', 'summary']) self.assertJobsEqual('done', ['fd', 'fd-gd', 'fd-gd-g2', 'hd', 'hd-id', 'hd-id-i2', 'summary']) # now redo it self.db = StorageFilesystem(self.root, compress=True) self.cc = Context(db=self.db) print('running again with both=False') mockup6(self.cc, both=False) clean_other_jobs(context=self.cc) self.assertJobsEqual('all', ['fd', 'fd-gd', 'fd-gd-g2', 'summary']) job= get_job('summary', self.db) print('job.children: %s' % job.children) print('job.dynamic_children: %s' % job.dynamic_children) self.assertEqual(job.dynamic_children, {'fd': set(['fd-gd'])}) self.assertEqualSet(direct_children('summary', self.db), ['fd', 'fd-gd']) self.assert_cmd_success('ls') self.assert_cmd_success('make recurse=1') self.assertJobsEqual('all', ['fd', 'fd-gd', 'fd-gd-g2', 'summary']) self.assertJobsEqual('done', ['fd', 'fd-gd', 'fd-gd-g2', 'summary'])