Skip to content

Commit ba683bc

Browse files
authored
Merge pull request #2281 from willend/main
Allow mcrun / mcdisplay to run / visualize without access to .c/.instr
2 parents 8b7a432 + 3bf12ec commit ba683bc

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tools/Python/mcrun/mccode.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,21 @@ def x_path(file):
128128
''' Return external path (relative to self.path) for file '''
129129
return '%s/%s' % (dirname(self.path), basename(file))
130130

131-
# Copy instrument file to cwd if not already there (for compatibility)
132-
if not isfile(basename(self.path)):
133-
shutil.copy2(self.path, ".") # also copies stat information
134-
135131
# Create the path for the binary
136132
if os.name == 'nt':
137133
self.binpath = '%s.%s' % (self.name, mccode_config.platform['EXESUFFIX'])
138134
else:
139135
self.binpath = './%s.%s' % (self.name, mccode_config.platform['EXESUFFIX'])
140136

137+
# Check if self.path is .exe or .out binary, if so - skip ahead to execution
138+
if self.path==basename(self.binpath):
139+
LOG.info('Called with binary file %s, skipping ahead to execution', self.binpath)
140+
return
141+
142+
# Copy instrument file to cwd if not already there (for compatibility)
143+
if not isfile(basename(self.path)):
144+
shutil.copy2(self.path, ".") # also copies stat information
145+
141146
# Check if c-code should be regenerated by comparing to instr timestamp
142147
existingC = findReusableFile(self.path,
143148
[self.cpath, x_path(self.cpath)])

tools/Python/mcrun/mcrun.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,7 @@ def get_parameters(options):
444444

445445

446446
def find_instr_file(instr):
447-
# Remove [-mpi].out to avoid parsing a binary file
448447
instr = clean_quotes(instr)
449-
if instr.endswith("-mpi." + mccode_config.platform['EXESUFFIX']):
450-
instr = instr[:-(5 + len(mccode_config.platform['EXESUFFIX']))]
451-
if instr.endswith("." + mccode_config.platform['EXESUFFIX']):
452-
instr = instr[:-(1 + len(mccode_config.platform['EXESUFFIX']))]
453448

454449
# Append ".instr" if needed
455450
if not isfile(instr) and isfile(instr + ".instr"):

0 commit comments

Comments
 (0)