Skip to content

Commit 409053c

Browse files
committed
reworked on the subprocess error that pylint complains
1 parent da5a121 commit 409053c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cime_config/buildlib

+10-10
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ def _build_musica(clone_dest: str) -> str:
287287
subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
288288
text=True, check=False)
289289
except subprocess.CalledProcessError as e:
290-
raise subprocess.CalledProcessError("The subprocess for cmake \
291-
to configure the MUSICA CMake project failed.") from e
290+
raise subprocess.CalledProcessError(e.returncode, e.cmd, "The subprocess \
291+
for cmake to configure the MUSICA CMake project failed.") from e
292292
except FileNotFoundError as e:
293293
raise FileNotFoundError("The 'cmake' command was not found.") from e
294294
except OSError as e:
@@ -299,8 +299,8 @@ def _build_musica(clone_dest: str) -> str:
299299
subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
300300
text=True, check=False)
301301
except subprocess.CalledProcessError as e:
302-
raise subprocess.CalledProcessError("The subprocess for cmake \
303-
to build the MUSICA library failed.") from e
302+
raise subprocess.CalledProcessError(e.returncode, e.cmd, "The subprocess \
303+
for cmake to build the MUSICA library failed.") from e
304304
except FileNotFoundError as e:
305305
raise FileNotFoundError("The 'cmake' command was not found.") from e
306306
except OSError as e:
@@ -379,8 +379,8 @@ def _set_musica_lib_path(musica_install_path: str, caseroot: str) -> None:
379379
subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
380380
text=True, check=False)
381381
except subprocess.CalledProcessError as e:
382-
raise subprocess.CalledProcessError("The subprocess for xmlchange \
383-
to set the MUSICA library path failed.") from e
382+
raise subprocess.CalledProcessError(e.returncode, e.cmd, "The subprocess \
383+
for xmlchange to set the MUSICA library path failed.") from e
384384
except FileNotFoundError as e:
385385
raise FileNotFoundError("The 'xmlchange' command was not found.") from e
386386
except OSError as e:
@@ -413,8 +413,8 @@ def _clone_and_checkout(repo_url: str, tag_name: str, clone_dest: str) -> None:
413413
subprocess.run(["git", "clone", repo_url, repo_path],
414414
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False)
415415
except subprocess.CalledProcessError as e:
416-
raise subprocess.CalledProcessError(f"The subprocess for git \
417-
to clone the repository {repo_url} failed.") from e
416+
raise subprocess.CalledProcessError(e.returncode, e.cmd, f"The subprocess \
417+
for git to clone the repository {repo_url} failed.") from e
418418
except FileNotFoundError as e:
419419
raise FileNotFoundError("The 'git' command was not found.") from e
420420
except OSError as e:
@@ -424,8 +424,8 @@ def _clone_and_checkout(repo_url: str, tag_name: str, clone_dest: str) -> None:
424424
subprocess.run(["git", "-C", repo_path, "checkout", tag_name],
425425
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False)
426426
except subprocess.CalledProcessError as e:
427-
raise subprocess.CalledProcessError(f"The subprocess for git \
428-
to checkout the branch {tag_name} failed.") from e
427+
raise subprocess.CalledProcessError(e.returncode, e.cmd, f"The subprocess \
428+
for git to checkout the branch {tag_name} failed.") from e
429429
except FileNotFoundError as e:
430430
raise FileNotFoundError("The 'git' command was not found.") from e
431431
except OSError as e:

0 commit comments

Comments
 (0)