thasso / pyjip

JIP Pipeline System
http://pyjip.readthedocs.org
Other
19 stars 8 forks source link

Option parsing fails when multiple list options are specified and one is optional and not set #8

Closed thasso closed 10 years ago

thasso commented 10 years ago

For example:

#!/usr/bin/env jip
# grr
#
# usage:
#     grr -i <in>... [-o <out>...]
#
# inputs:
#     -i, --input <in>...  the input
#
# outputs:
#     -o, --output <out>...  the output
touch ${input} ${output}

an exception is raised if only input is given:

Traceback (most recent call last): File "/apps/DEVEL/jip/0.3/bin/jip", line 9, in load_entry_point('pyjip==0.3', 'console_scripts', 'jip')() File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/cli/jip_main.py", line 78, in main _main() File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/cli/jip_main.py", line 135, in _main runpy.run_module("jip.cli.jip_interpreter", run_name="main") File "/usr/lib64/python2.6/runpy.py", line 140, in run_module fname, loader, pkg_name) File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code exec code in run_globals File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/cli/jip_interpreter.py", line 63, in main() File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/cli/jip_interpreter.py", line 59, in main jip_run(jip_args + [script_file] + script_args) File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/cli/jip_run.py", line 52, in main dry(script, script_args, dry=args['--dry'], show=args['--show']) File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/cli/init.py", line 566, in dry jobs = jip.jobs.create_jobs(script, args=script_args) File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/jobs.py", line 994, in create_jobs pipeline.expand(validate=validate) File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/pipelines.py", line 781, in expand self._expand_merge_duplicates() File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/pipelines.py", line 1078, in _expand_merge_duplicates opt_set = n._tool.options._get_value_set() File "/apps/DEVEL/jip/0.3/lib/python/pyjip-0.3-py2.7-linux-x86_64.egg/jip/options.py", line 841, in _get_value_set for v in vs])) TypeError: unhashable type: 'list'