if a spec file ends with a comment and the last character isnt a newline, catalyst takes the line as an option: !!! catalyst: Argument "# this is a comment" not recognized. steps to reproduce: create a spec file with a comment at the end that doesnt end with a newline. workaround: add a newline if your file ends with a comment. affected versions: i have only tried 2.0_rc41
Created attachment 84747 [details, diff] cleanup of parse_spec() This patch cleans up some horribly ugly python code and fixes this bug. I have done some limited testing of the code, and it seems to work fine. >>> import catalyst_support >>> foo = ["livecd/use: a b c\n", " d e f\n", " g h i\n", "livecd/foo: bar\n", " baz\n", "# this is a comment"] >>> catalyst_support.parse_spec(foo) {'livecd/foo': ['bar', 'baz'], 'livecd/use': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']}
I also tested that it preserves the old "single value is a string, multiple values is a list" behavior. >>> import catalyst_support >>> foo = ["livecd/use: a b c\n", " d e f\n", " g h i\n", "livecd/foo: bar\n", " baz\n", "livecd/bar: baz\n", "# this is a comment"] >>> catalyst_support.parse_spec(foo) {'livecd/foo': ['bar', 'baz'], 'livecd/use': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], 'livecd/bar': 'baz'}
And if you don't want to use the entire cleanup patch, this particular bug can be fixed with just a small part of it: - trailing_comment=re.compile("#.*\n") + trailing_comment=re.compile("#.*$")
I've added Andrew's patch to CVS and I'll resolve this after the next catalyst release.
Fixed in 2.0_rc42! Thanks for the patch, Andrew.