Danek Duvall wrote:
Brock Pytlik wrote:
http://cr.opensolaris.org/~bpytlik/ips-11805-v1/
__init__.py:
[snip]
- I don't understand why you haven't simply enhanced fromstr() and
fromlist() to take the optional basedirs and load_data arguments.
I think because I view these as fundamentally different operations.
Fromstr works on the "true"/"real"/"correct" representations of the file
action, one which has no reference to the proto area. internalize* are
functions which make the conversion from the external format (ie, a
path/NOHASH payload) to an internalize representation (one using the
data field) explicit. I think that's something we want to separate as
there's potential for a fair amount of confusion. I, at least, certainly
took a long time to get the details straight in my head, and I think
conflating the representations within fromstr would add to, not remove,
that confusion.
Also, it greatly reduced the potential impact, especially the
performance impact, of my change since many, many places in the code
call fromstr while only pkgsend and pkgdep use the functionality of
internalizestr.
[snip]
manifest.py:
- this functionality is really useful, but I'd like to see it implemented
differently -- drop actions_set_content(), but allow the "content"
parameter to set_content() to have multiple types.
I think we've had this conversation before, but I think having functions
which accept types with materially different interfaces (ie, the code
basically has to do isinstance/issubclass), leads to code which is
harder to maintain and use. (Maybe I've simply missed the right way to
handle this, but I'm pretty sure such a check will need to be made.)
That said, I guess this is the "pythonic" way of doing things, so I'll
switch to it.
(If the objection is to having the initialization duplicated, I'm happy
to break that out into a common function as well, I just hadn't thought
of it till now.)
You'll probably
want to keep __add_action(), and just have set_content() call it
repeatedly based either on the list of actions or on the output of the
calls to fromstr(). You may or may not want to put the splitlines()
loop into its own private generator function.
Thanks for the ideas. I suspect you're right that making the splitlines
loop into a generator is the way to go.
Brock
Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss