support paths relative to the user's home directory (~/foo)

Bug #190260 reported by Marius Gedminas
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Buildout
New
Undecided
Unassigned

Bug Description

I'd like to specify the download cache relative to my home directory. The traditional Unix way is

[buildout]
download-cache = ~/tmp/buildout-download-cache

however zc.buildout currently doesn't interpret '~'.

Revision history for this message
Barry Warsaw (barry) wrote :

I wonder if a more general solution wouldn't be to expand environment variables in buildout.cfg files. Then you'd be able to say

[buildout]
download-cache = $HOME/tmp/buildout-download-cache

I think I'd like that better than ~ expansion, but honestly I don't have an immediate use case other than $HOME.

Revision history for this message
Jim Fulton (jim-zope) wrote : Re: [Bug 190260] Re: support paths relative to the user's home directory (~/foo)

On Jan 8, 2009, at 4:10 PM, Barry Warsaw wrote:

> I wonder if a more general solution wouldn't be to expand environment
> variables in buildout.cfg files. Then you'd be able to say
>
> [buildout]
> download-cache = $HOME/tmp/buildout-download-cache
>
> I think I'd like that better than ~ expansion, but honestly I don't
> have
> an immediate use case other than $HOME.

I'm not sure if I'd like it better or not. If we did something like
this though, I think I'd want to spell it a little differently.
I'm thinking that there might be some sort os pseudo section, say
ENVIRONMENT, so you could do:

    ${ENVIRONMENT:HOME}

You could even specify an ENVIRONMENT section in a buildout file to
provide a default. But the main reason I'd prefer something like this
is to not introduce a new variable-substitution syntax.

Jim

--
Jim Fulton
Zope Corporation

Revision history for this message
Marius Gedminas (mgedmin) wrote :

$HOME would be fine for me too, as well as variations such as ${HOME}, or even ${env:HOME}, if consistency with the existing variable substitution schemes is desired.

Revision history for this message
Alex Clark (aclark) wrote :

+1000 for ${ENVIRONMENT:*} in buildout, if I could do ${ENVIRONMENT:USER} that would be very useful. For example, I'd like to be able to set effective-user = ${ENVIRONMENT:USER} when running supervisor as root (which would allow some root, some non-root processes to be controlled by supervisor). But also, having the environment available in buildout would make people more comfortable using it, IMO.

Revision history for this message
Philipp von Weitershausen (philikon) wrote :

Seems like http://pypi.python.org/pypi/gocept.recipe.env already does
the job.

Revision history for this message
Encolpe Degoute (encolpe) wrote :

It tries to do the job.
As there is no escape character in buildout substitution it fails to be rebuild when an environment variable contains ${}.

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Is it safe to use a 3rd party recipe from ~/.buildout/default.cfg? Even if it is, it's not convenient.

My primary motivation for this request was to make it easier to teach people unfamiliar with buildout how to make it faster: "create a file named this with this content". Currently the content is two lines (good) but must vary per-user (bad).

Revision history for this message
Florian Friesdorf (flo-chaoflow) wrote :

in #557769 i posted patched that enable:

${env:variable}, the variable itself may contain references to further sections:options

it can also be used for extends, but without further references in that case

Revision history for this message
Florian Friesdorf (flo-chaoflow) wrote :

full link: https://bugs.launchpad.net/zc.buildout/+bug/557769

I am happy to adjust to ${ENVIRONMENT:...}

Revision history for this message
Marc Abramowitz (msabramo) wrote :

${env:..} or ${environment:...} would be really nice so that I could share my ~/.buildout/default.cfg file between systems.

Revision history for this message
Encolpe Degoute (encolpe) wrote :

I made it in a branch that was never merged. Shame on me.
I will try to update it and produce needed usecases and tests.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.