-
Notifications
You must be signed in to change notification settings - Fork 176
Add config option: optional-extends. #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is the same as the `extends` option, but then for optional files. The names must be file paths, not URLs. If the path does not exist, it is silently ignored. This is useful for optionally loading a `local.cfg` or `custom.cfg` with options specific for the developer or the server. I have seen various ways of having local options without checking this into version control: * Let git ignore `buildout.cfg` and have a sample `buildout.cfg.in` that you copy to `buildout.cfg` and adapt for the machine. * Have a `local.cfg` that extends `buildout.cfg` or an alternative like `devel.cfg` or `production.cfg`. * Let `buildout.cfg` extend `custom.cfg` which is not in version control, so you get an error when you don't yet have this file. When this PR is merged, I intend to use this in the Plone core development buildout.
8aa75f4
to
0075582
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea seems to be interesting. I am not sure whether I'll be going to use it (went without it for > 10 years).
Mabye a message would be handy if the optional file does not exist. Could be rendered only in vebose mode (?).
Good point. I now print a message when not found, regardless of verbosity:
It would usually be the first line that is printed. This seems a useful hint for anyone using a Buildout with optional-extends. |
Good idea ! Thanks for working on this ! |
Thanks for the reviews. I have released 3.2.0 with this. |
I added this option in buildout/buildout#665 For inspiration, here is part of my own `local.cfg`: ``` [buildout] develop += /Users/maurits/community/zest.releaser auto-checkout += plone.releaser custom-eggs += pdbpp allow-picked-versions = true [remotes] plone = [email protected]:plone collective = [email protected]:collective zope = [email protected]:zopefoundation [versions] zest.releaser = ``` Originally the file started with these lines: ``` [buildout] extends = buildout.cfg ``` and then I always ran `bin/buildout -c local.cfg`. When I then wanted to use `plips/plip-distributions.cfg`, it got tricky because this was in a different directory, so I needed actual changes in git. Now it works in both cases thanks to the `optional-extends`.
I added this option in buildout/buildout#665 For inspiration, here is part of my own `local.cfg`: ``` [buildout] develop += /Users/maurits/community/zest.releaser auto-checkout += plone.releaser custom-eggs += pdbpp allow-picked-versions = true [remotes] plone = [email protected]:plone collective = [email protected]:collective zope = [email protected]:zopefoundation [versions] zest.releaser = ``` Originally the file started with these lines: ``` [buildout] extends = buildout.cfg ``` and then I always ran `bin/buildout -c local.cfg`. When I then wanted to use `plips/plip-distributions.cfg`, it got tricky because this was in a different directory, so I needed actual changes in git. Now it works in both cases thanks to the `optional-extends`.
I just saw this in the pypi release notes. I've been using a workaround for this for a few years now; optional-extends is a great idea. Thank you! |
This is the same as the
extends
option, but then for optional files. The names must be file paths, not URLs. If the path does not exist, it is silently ignored.This is useful for optionally loading a
local.cfg
orcustom.cfg
with options specific for the developer or the server.I have seen various ways of having local options without checking this into version control:
buildout.cfg
and have a samplebuildout.cfg.in
that you copy tobuildout.cfg
and adapt for the machine.local.cfg
that extendsbuildout.cfg
or an alternative likedevel.cfg
orproduction.cfg
.buildout.cfg
extendcustom.cfg
which is not in version control, so you get an error when you don't yet have this file.When this PR is merged, I intend to use this in the Plone core development buildout.