Skip to content

602 handle lists indicated with comma specially#658

Merged
boegel merged 35 commits intoeasybuilders:developfrom
fgeorgatos:602_handle_lists_indicated_with_comma_specially
Jul 1, 2013
Merged

602 handle lists indicated with comma specially#658
boegel merged 35 commits intoeasybuilders:developfrom
fgeorgatos:602_handle_lists_indicated_with_comma_specially

Conversation

@fgeorgatos
Copy link
Copy Markdown
Contributor

OK, this PR should allow the idea proposed by boegel in #602.

Signed-off-by: Fotis Georgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
Signed-off-by: Fotis Georgatos <[email protected]>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify what's going on with a comment?

Why is it important to get rid of empty strings in val? What about None?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The brief feedback for this diff is:
"if val dict contains empty strings '', filter them out from it, otherwise behave as before".
ie. I ride on the fact that current code cannot handle --amend=source=,tarball.tar.gz well and make a feature out of it.
If I'm not mistaken, this is what was proposed by you in an earlier message, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this looks nicer, let's fix it:

>>> val=['hello', '']
>>> fval = [x for x in val if x]
>>> fval
['hello']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your version is more general, i.e. it also filters out None, which shouldn't be there in the first place. So, it would hide bugs that introduced problems earlier... (sorry to be confusing)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, our off-line discussion with Ken revealed that the following would be more intuitive:

  • starts with comma => prepends # ,hello.tgz
  • end with comma => append # hello.tgz,
  • else => overwrite # hello.tgz,world.tgz

IMHO, we hit a case alike: http://golang.org/doc/go1compat.html -> "Specification"
and we should be going to fix the comma behavior, agreed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed as asked, not yet tried in practice to make a comment on real-life results.

Comment thread easybuild/framework/easyconfig/tools.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the logic about not including res.group(1) here? Shouldn't it be more something like:

fval = [x for x in val if x != '']
newval = "%s + %s" % (fval, res.group(1))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK, now I see what's going on, it's about prepend vs overwrite... But the logic is reversed.

What we want is:

  • starts with , => append to list
  • ends with , => prepend to list
  • else: overwrite

This breaks backward compatibility, but that's OK imho, since this is a rarely-depended on feature afaik.

Comment thread easybuild/framework/easyconfig/tools.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix indentation of comment.

Signed-off-by: Fotis Georgatos <[email protected]>
Comment thread easybuild/framework/easyconfig/tools.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use elif val[-1] == '' here

fgeorgatos and others added 4 commits July 1, 2013 16:25
… for prepend/append/overwrite feature for amending list easyconfig values
…ma_specially

602 handle lists indicated with comma specially
@fgeorgatos
Copy link
Copy Markdown
Contributor Author

OK merged; nice extras from Ken on _log.debug; I also hadn't seen the indentation issue really until now (facepalm)

@boegel
Copy link
Copy Markdown
Member

boegel commented Jul 1, 2013

Unit tests pass, so good to merge in!

boegel added a commit that referenced this pull request Jul 1, 2013
…th_comma_specially

602 handle lists indicated with comma specially
@boegel boegel merged commit e2f8e95 into easybuilders:develop Jul 1, 2013
@fgeorgatos fgeorgatos deleted the 602_handle_lists_indicated_with_comma_specially branch July 1, 2013 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants