def _perform(self): self.retval["error"] = True self.retval["filetype"] = "Unknown" try: for form, std, extra in [ ("fixed", "legacy", ""), ("free", "f95", ""), ("free", "f2003", ""), ("free", "f2008", "-fcoarray=single"), ]: tmpfile = "%s/.__tmpfile" % self.dirname stdout, stderr = runcmd( "gfortran -c -std=%s -f%s-form -o %s %s %s" % (std, form, tmpfile, extra, self.abspath) ) # print '%s STDOUT: '%std, stdout # print '%s STDERR: '%std, stderr if os.path.exists(tmpfile): os.remove(tmpfile) if stderr: continue self.retval["error"] = False self.retval["filetype"] = "Fortran Source Code: %s standard" % std break except: pass return self.retval
def run(self, session_id, order, src_dir, \ os_text, order_flags, remove_files=True): retval = {'error': True, 'msg': 'Unknown'} # mkdir build and run subdirectory under session directory session_dir = '%s/session/%s'%(SCRIPT_DIR, session_id) work_dir = '%s/work'%session_dir if not os.path.exists(session_dir): os.makedirs(session_dir) if not os.path.exists(work_dir): os.makedirs(work_dir) # copy source files into build directory for path in glob.iglob('%s/*'%src_dir): shutil.copy( path, '%s' % work_dir) shutil.copy('%s/script/do.py'%SCRIPT_DIR, session_dir) # run docker cmd = 'docker run -t -v %s:/home %s python3 /home/do.py %s %s' % \ (session_dir, DOCKER_IMAGE, order, order_flags) out, err = runcmd(cmd) retval['stdout'] = str(out) retval['stderr'] = str(err) retval['error'] = False print "STDOUT: ", str(out) print "STDERR: ", str(err) # analyze the build and run result # generate output and return return retval
def _perform(self): self.retval["error"] = True self.retval["filetype"] = "Unknown" stdout, stderr = runcmd("make --just-print -f %s" % self.abspath) # print 'make STDOUT: ', stdout # print 'make STDERR: ', stderr if stderr: return self.retval else: self.retval["error"] = False self.retval["filetype"] = "GNU Makefile" return self.retval
def _perform(self): self.retval['error'] = True self.retval['filetype'] = 'Unknown' stdout, stderr = runcmd('make --just-print -f %s' % self.abspath) #print 'make STDOUT: ', stdout #print 'make STDERR: ', stderr if stderr: return self.retval else: self.retval['error'] = False self.retval['filetype'] = 'GNU Makefile' return self.retval
def _perform(self): self.retval['error'] = True self.retval['filetype'] = 'Unknown' try: for form, std, extra in [('fixed', 'legacy', ''), ('free', 'f95', ''), \ ('free', 'f2003', ''), ('free', 'f2008', '-fcoarray=single')]: tmpfile = '%s/.__tmpfile' % self.dirname stdout, stderr = runcmd('gfortran -c -std=%s -f%s-form -o %s %s %s'%\ (std, form, tmpfile, extra, self.abspath)) #print '%s STDOUT: '%std, stdout #print '%s STDERR: '%std, stderr if os.path.exists(tmpfile): os.remove(tmpfile) if stderr: continue self.retval['error'] = False self.retval[ 'filetype'] = 'Fortran Source Code: %s standard' % std break except: pass return self.retval