Commit d79ba751 authored by Niels Dekker's avatar Niels Dekker

ENH: Restored --make-shell-scripts support

Now using ".bat" file extension if platform is 'Windows'. Discussed with @kaspermarstal
parent c58ecc66
import os, json, argparse
import os, json, argparse, platform
from ContinuousRegistration.Source.datasets import logging, load_datasets
from ContinuousRegistration.Source.util import load_submissions
......@@ -9,8 +9,8 @@ parser.add_argument('--submissions-directory', '-sd', required=True,
help='Directory with parameter files.')
parser.add_argument('--output-directory', '-od', required=True,
help="Directory where results will be saved.")
parser.add_argument('--make-scripts', '-ms', choices=['shell', 'batch'], default='shell',
help="Generate shell scripts or batch scripts (default: shell).")
parser.add_argument('--make-shell-scripts', '-mss', type=bool, default=True,
help="Generate shell scripts (default: True).")
parser.add_argument('--brain2d-input-directory', '-b2d')
parser.add_argument('--lung2d-input-directory', '-l2d')
parser.add_argument('--cumc12-input-directory', '-cid')
......@@ -35,6 +35,10 @@ parser.add_argument('--source-directory', '-srcd', default='.')
def run(parameters):
if not parameters.make_shell_scripts:
logging.error('--make-shell-scripts was False. Nothing to do.')
submissions = load_submissions(parameters)
datasets = load_datasets(parameters)
......@@ -71,8 +75,8 @@ def run(parameters):
output_directory = os.path.join(parameters.output_directory,
team_name, blueprint_name)
if parameters.make_scripts in ('shell', 'batch'):
ext = '.sh' if parameters.make_scripts == 'shell' else '.bat'
if parameters.make_shell_scripts:
ext = '.bat' if platform.system() == 'Windows' else '.sh'
file_names, output_directory, ext)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment