Skip to content
Snippets Groups Projects
Commit ef2bad14 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

ENH: --dry-run option

parent a12551b5
No related branches found
No related tags found
1 merge request!45New update_fsl_package script
...@@ -522,7 +522,7 @@ def confirm_installation(packages : Sequence[Package], yes : bool) -> bool: ...@@ -522,7 +522,7 @@ def confirm_installation(packages : Sequence[Package], yes : bool) -> bool:
return response.strip().lower() in ('', 'y', 'yes') return response.strip().lower() in ('', 'y', 'yes')
def install_packages(packages : Sequence[Package]): def install_packages(packages : Sequence[Package], dry_run : bool):
"""Calls conda to update the given collection of packages. """ """Calls conda to update the given collection of packages. """
fsldir = os.environ['FSLDIR'] fsldir = os.environ['FSLDIR']
...@@ -530,7 +530,10 @@ def install_packages(packages : Sequence[Package]): ...@@ -530,7 +530,10 @@ def install_packages(packages : Sequence[Package]):
cmd = f'install --no-deps -p {fsldir} -y ' + ' '.join(packages) cmd = f'install --no-deps -p {fsldir} -y ' + ' '.join(packages)
print('\nInstalling packages...') print('\nInstalling packages...')
conda(cmd, False) if dry_run:
conda(cmd, False)
else:
print(f'Dry run - would execute {cmd}')
def parse_args(argv : Optional[Sequence[str]]) -> argparse.Namespace: def parse_args(argv : Optional[Sequence[str]]) -> argparse.Namespace:
...@@ -553,6 +556,7 @@ def parse_args(argv : Optional[Sequence[str]]) -> argparse.Namespace: ...@@ -553,6 +556,7 @@ def parse_args(argv : Optional[Sequence[str]]) -> argparse.Namespace:
parser.add_argument('--username', help=argparse.SUPPRESS) parser.add_argument('--username', help=argparse.SUPPRESS)
parser.add_argument('--password', help=argparse.SUPPRESS) parser.add_argument('--password', help=argparse.SUPPRESS)
parser.add_argument('--verbose', help=argparse.SUPPRESS, action='store_true') parser.add_argument('--verbose', help=argparse.SUPPRESS, action='store_true')
parser.add_argument('--dry-run', help=argparse.SUPPRESS, action='store_true')
args = parser.parse_args(argv) args = parser.parse_args(argv)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment