diff --git a/tools/Python/mcrun/mccode.py b/tools/Python/mcrun/mccode.py index 064b55bb8..ae217f448 100755 --- a/tools/Python/mcrun/mccode.py +++ b/tools/Python/mcrun/mccode.py @@ -128,16 +128,21 @@ def x_path(file): ''' Return external path (relative to self.path) for file ''' return '%s/%s' % (dirname(self.path), basename(file)) - # Copy instrument file to cwd if not already there (for compatibility) - if not isfile(basename(self.path)): - shutil.copy2(self.path, ".") # also copies stat information - # Create the path for the binary if os.name == 'nt': self.binpath = '%s.%s' % (self.name, mccode_config.platform['EXESUFFIX']) else: self.binpath = './%s.%s' % (self.name, mccode_config.platform['EXESUFFIX']) + # Check if self.path is .exe or .out binary, if so - skip ahead to execution + if self.path==basename(self.binpath): + LOG.info('Called with binary file %s, skipping ahead to execution', self.binpath) + return + + # Copy instrument file to cwd if not already there (for compatibility) + if not isfile(basename(self.path)): + shutil.copy2(self.path, ".") # also copies stat information + # Check if c-code should be regenerated by comparing to instr timestamp existingC = findReusableFile(self.path, [self.cpath, x_path(self.cpath)]) diff --git a/tools/Python/mcrun/mcrun.py b/tools/Python/mcrun/mcrun.py index 28e2f4936..2e74c84ce 100644 --- a/tools/Python/mcrun/mcrun.py +++ b/tools/Python/mcrun/mcrun.py @@ -444,12 +444,7 @@ def get_parameters(options): def find_instr_file(instr): - # Remove [-mpi].out to avoid parsing a binary file instr = clean_quotes(instr) - if instr.endswith("-mpi." + mccode_config.platform['EXESUFFIX']): - instr = instr[:-(5 + len(mccode_config.platform['EXESUFFIX']))] - if instr.endswith("." + mccode_config.platform['EXESUFFIX']): - instr = instr[:-(1 + len(mccode_config.platform['EXESUFFIX']))] # Append ".instr" if needed if not isfile(instr) and isfile(instr + ".instr"):