Skip to content

Commit 7f43434

Browse files
committed
Update to mache 3.2.0
1 parent c00650c commit 7f43434

3 files changed

Lines changed: 29 additions & 18 deletions

File tree

deploy.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,16 @@ def _merge_optional_cli_spec(cli_spec, custom_cli_spec):
260260
if custom_cli_spec is None:
261261
return cli_spec
262262

263+
merged_meta = dict(cli_spec.get('meta', {})) # type: dict
264+
merged_arguments = list(cli_spec.get('arguments', [])) # type: list
263265
merged = {
264-
'meta': dict(cli_spec.get('meta', {})),
265-
'arguments': list(cli_spec.get('arguments', [])),
266+
'meta': merged_meta,
267+
'arguments': merged_arguments,
266268
}
267269

268270
seen_dests = set()
269271
seen_flags = set()
270-
for entry in merged['arguments']:
272+
for entry in merged_arguments:
271273
dest = entry.get('dest')
272274
if dest:
273275
seen_dests.add(dest)
@@ -289,7 +291,7 @@ def _merge_optional_cli_spec(cli_spec, custom_cli_spec):
289291
'ERROR: deploy/custom_cli_spec.json duplicates generated '
290292
f'flags: {dup_str}'
291293
)
292-
merged['arguments'].append(entry)
294+
merged_arguments.append(entry)
293295
if dest:
294296
seen_dests.add(dest)
295297
seen_flags.update(flags)
@@ -540,21 +542,30 @@ def _run_mache_deploy_run(pixi_exe, repo_root, mache_run_argv):
540542
f'ERROR: bootstrap pixi project not found. Expected: {pixi_toml}'
541543
)
542544

543-
# Build a bash command that runs mache inside pixi, then cd's to repo.
544-
mache_cmd = 'mache deploy run'
545+
env = os.environ.copy()
546+
for var in (
547+
'PIXI_PROJECT_MANIFEST',
548+
'PIXI_PROJECT_ROOT',
549+
'PIXI_ENVIRONMENT_NAME',
550+
'PIXI_IN_SHELL',
551+
):
552+
env.pop(var, None)
553+
554+
cmd = [
555+
pixi_exe,
556+
'run',
557+
'-m',
558+
pixi_toml,
559+
'--',
560+
'mache',
561+
'deploy',
562+
'run',
563+
]
545564
if mache_run_argv:
546-
mache_cmd = f'{mache_cmd} ' + ' '.join(
547-
shlex.quote(a) for a in mache_run_argv
548-
)
565+
cmd.extend(mache_run_argv)
549566

550-
cmd = (
551-
f'env -u PIXI_PROJECT_MANIFEST -u PIXI_PROJECT_ROOT '
552-
f'-u PIXI_ENVIRONMENT_NAME -u PIXI_IN_SHELL '
553-
f'{shlex.quote(pixi_exe)} run -m {shlex.quote(pixi_toml)} bash -lc '
554-
f'{shlex.quote("cd " + repo_root + " && " + mache_cmd)}'
555-
)
556567
try:
557-
subprocess.check_call(['/bin/bash', '-lc', cmd])
568+
subprocess.run(cmd, cwd=repo_root, env=env, check=True)
558569
except subprocess.CalledProcessError as e:
559570
raise SystemExit(
560571
f'\nERROR: Deployment step failed (exit code {e.returncode}). '

deploy/cli_spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"meta": {
33
"software": "compass",
4-
"mache_version": "3.1.0",
4+
"mache_version": "3.2.0",
55
"description": "Deploy compass environment"
66
},
77
"arguments": [

deploy/pins.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ bootstrap_python = 3.14
44
python = 3.14
55
esmf = 8.9.1
66
geometric_features = 1.6.1
7-
mache = 3.1.0
7+
mache = 3.2.0
88
mpas_tools = 1.4.0
99
otps = 2021.10
1010
parallelio = 2.6.9

0 commit comments

Comments
 (0)