Skip to content

Commit 91daee8

Browse files
update call
1 parent 7d939b5 commit 91daee8

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

umdp3_fixer/rosestem_branch_checker.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,14 @@ def diff_cwd_working(model_source, path, saved_umask, tmpdir):
100100
return
101101

102102

103-
def run_umdp3checker(model_source, path, amp_column):
103+
def run_umdp3checker(model_source, fixer_source, path, amp_column):
104104
"""Run the umdp3 fixer script in the tmp dir copy of the working branch."""
105+
command = (
106+
f"{os.path.join(fixer_source, 'umdp3_fixer.py')} --col {amp_column} "
107+
f"$(find {path} -name '*.[F|f]90' -o -name '*.inc' | xargs)"
108+
)
105109
result = subprocess.run(
106-
model_source
107-
+ "/rose-stem/bin/umdp3_fixer.py "
108-
+ "--col {0:} ".format(amp_column)
109-
+ "$(find "
110-
+ path
111-
+ " -name '*.[F|f]90' -o -name '*.inc' | xargs)",
110+
command,
112111
capture_output=True,
113112
check=False,
114113
stdin=subprocess.DEVNULL,
@@ -148,6 +147,15 @@ def main():
148147
)
149148
# e.g. "--source model_source_branch"
150149

150+
parser.add_option(
151+
"--fixer_source",
152+
dest="fixer_source",
153+
action="store",
154+
help="the directory containing the fixer scripts - defaults to "
155+
"source/rose-stem/bin",
156+
default=None
157+
)
158+
151159
parser.add_option(
152160
"--col",
153161
dest="col",
@@ -161,10 +169,13 @@ def main():
161169
# Parse the command line.
162170
(opts, _) = parser.parse_args()
163171
model_source = opts.source
172+
fixer_source = opts.fixer_source
173+
if fixer_source is None:
174+
fixer_source = os.path.join(model_source, "rose-stem", "bin")
164175
amp_column = opts.col
165176

166177
(path, saved_umask, tmpdir) = copy_working_branch(model_source)
167-
run_umdp3checker(model_source, path, amp_column)
178+
run_umdp3checker(model_source, fixer_source, path, amp_column)
168179
diff_cwd_working(model_source, path, saved_umask, tmpdir)
169180

170181
os.umask(saved_umask)

0 commit comments

Comments
 (0)