[16:02:44] <pombreda_> What would be the way to remove a section using a buildout extension?
[16:05:20] <pombreda_> del buildout['section name'] is not implemented and del buildout._raw['section name'] does not do what I would need ... whic would the equivalent of parts -= <section name>
[16:11:35] <J1m> It's a bad idea to depend on internal implementation details.
[16:14:46] <pombreda_> J1m: roger that, I am hacking some test stuffs for doing conditional sections... section that get removed if they have a skip_if python expression that evals to True
[16:16:28] <J1m> If you're just hacking, hack on a fork of buildout itself. Rather that deleting sections, filter them when they're being gathered. This is something I'd be open to as a pull request.
[16:17:21] <J1m> The hardest part is deciding on a filtering condition language that isn't heinous.
[16:17:47] <J1m> btw, my vision for this is uses like: [mysection:win32]
[16:18:25] <J1m> I discussed this with someone here a few weeks ago.
[16:19:15] <pombreda_> J1m: ok, the filtering condition would at first be a python expression with no locals, no globals and no builtins... then relaxing this later
[16:22:50] <J1m> why would you care about option names?
[16:23:33] <J1m> Note that in buildout 2, there are many more restrictions on option and section names.
[16:24:34] <J1m> In particular, ':' is not allowed in either.
[16:26:04] <pombreda_> J1m: I would care if a design would be to add the expression as a section option, rather than in the section title. but if you prefer add this in the title that is a non issue
[16:27:56] <J1m> The first Python version of buildout, used internally at ZC had platform tags in section heafers {mysection:win32]. This was very helpful for project built on both linux and windows.
[16:37:16] <J1m> who cares? This isn't a long running process and if you accept buildout configs from untrusted sources, you probably have bigger problems.
[16:37:58] <pombreda_> J1m: indeed, .... so one design approach would: do not allow expressions to be defined in titles, that would be ugly... instead provide default booleans and additional expressions could defined in an expression option of [buildout]
[16:39:37] <pombreda_> so [section:win32] would look for a either a predef boolean or if not found in an expression provided for instance in [buildout] condition-expression = win32 = 'win32' in sys.platform
[17:08:49] <J1m> The globals should default to {} (meaning default to None, which is converted to an empty dict at run time)
[17:09:04] <pombreda_> I see three place where the configparser is called: _read_installed_part_options (does not make sense to have expression here), _open (which makes most sense) and _dir_hash which puzzles me
[17:16:01] <pombreda_> J1m: not sure what you mean about the default globals above, you mean in the function signature for configparser.parse ? chainging it from parse(fp, fpname) to parse(fp, fpname, globals=None)?
[17:19:50] <J1m> so you'll evaluate an expr with eval(expr, globals)
[17:19:56] <pombreda_> J1m: the syntax for the section title would become essentially the same as for an option except the separator would be header:expression instead of name=value
[17:20:15] <pombreda_> J1m: with an eventual removal of builtins
[17:20:22] <pombreda_> not sure that matters though
[17:29:01] <pombreda_> J1m: a regex for parsing the title would become ... \[\s*(?P<header>[^\s[\]:{}]+)\s*:?(?P<expression>.*)\s*]\s*([#;].*)?$ this would require a bit split in something easier to read :P
[17:36:18] <pombreda_> J1m: UI used to be manage the program for the Eclipse foundation so i am somewhat familiar with it
[17:36:37] <J1m> I think you're regex is wrong, but write tests :)
[17:37:01] <J1m> wrt docs, yes, the experiment of reusing tests as docs failed.
[17:37:04] <pombreda_> actually the expression is .* so it globs spaces, but yes, regex are devilish without tests
[17:37:27] <J1m> buildut needs docs. I'm skeptical that a student could write them (or would want to).
[17:37:44] <J1m> people keep threatening to help with docs, but it never pans out.
[17:38:00] <J1m> I'll probably need to take that on at some point.
[17:38:53] <J1m> I have no idea what you mean by "zope seems to have fewer interest in this after 2008 though"
[17:39:14] <J1m> and yes, I still like doctests for tests.
[17:39:16] <pombreda_> J1m: doc is a punishement .... it cannoy be used as a credible threat :D
[17:39:52] <J1m> I also like using documentation as tests, as long as doc is really doc.
[17:39:53] <pombreda_> J1m: zope as a foundation seems to have not participated in the Google Summer of code after 2008
[17:40:36] <J1m> See for example http://bobo.digicool.com/ and http://packages.python.org/zc.ngi/
[17:40:58] <J1m> ah, gsoc. Yeah, I don't track that.
[17:42:34] <pombreda_> J1m: about doc, the thing with buildout is that doctests are _not_ showing the way one actually _uses_ buildout... instead rather how it works when called from python, which is the least likely to happen in most use case
[17:43:45] <J1m> documentation should also be executable and can server as a subset of the tests, but it has to be designed as documentation.
[17:43:54] <J1m> tests are only a useful by product.
[17:44:27] <J1m> I still like using doctest for tests, even if they don't make good documentation.
[17:44:28] <pombreda_> I will not threaten of writing docs though atm ... but I guess if you would start with a simple 10 liners showing where you want to go pushing docs would be easier
[17:44:56] <pombreda_> J1m: and about doctest there is a badzillions of recipes that use the same approach you did and only have doctests as docs :P
[17:46:51] <J1m> especially for something as powerful and thus complex as buildout.
[17:47:52] <J1m> There's a rather simple transformation that could be applied to the existing doctest that would make them much more readable and useful, even though the organization would still be wrong.
[17:48:12] <pombreda_> J1m: indeed ... the other projects may not have teh reach of it too... that said the only think that could come to mind for higher level docs as tests was fitnesse and may be roboframework nowadays though I have not used the later
[17:48:27] <J1m> The transformation being to convert them to use manuel.
[17:49:18] <J1m> then config files would be shown directly (without python "write" calls and system commands could be shown more naturally.
[17:49:44] <J1m> This could almost be done mechanically.
[17:50:04] <J1m> I need to update some of the tests to show the way and see if volunteers could do the others.
[17:51:01] <J1m> The configparser tests use manuel and they look much better than they would otherwise.
[17:54:33] <pombreda_> J1m: manuel is awesome! I though you had made a typo and meant manual :D