|
|
|
Issue 11 of
buildit_issues
[BUILDIT]
|
| Title: |
expand tildes
|
| Status: |
Pending
|
Security |
related:
No
|
| Description: |
On Aug 13, 2007, at 3:28 PM, Shenton Chris wrote (via buildit list):
I've started to use buildit for a project here and have been compiling a bunch o...
|
| From: |
Anonymous User
|
on: |
Aug 13, 07 19:56
|
| |
Anonymous User
|
Last update:
|
Aug 13, 07 19:59
|
| Topic/class: |
Zope/feature
|
Importance:
|
medium
|
| Version info: |
|
|
Issue 11 Transcript
|
|
4 entries
|
= Comment - Entry #4 by Anonymous User on Aug 13, 2007 7:59 pm
Another way to do this would be to just expose "environment" as a top level namespace.
________________________________________
= Comment - Entry #3 by Anonymous User on Aug 13, 2007 7:57 pm
I checked in the ${userhome} builtin. I'll need to see if I can figure out how to expand tildes in path names later.
________________________________________
= Comment - Entry #2 by Anonymous User on Aug 13, 2007 7:56 pm
One patch to context.py would allow you to do this:
Index: context.py
===================================================================
RCS file: /home/agendaless/cvs/Packages/buildit/context.py,v
retrieving revision 1.5
diff -u -r1.5 context.py
--- context.py 8 Apr 2007 01:13:23 -0000 1.5
+++ context.py 13 Aug 2007 19:39:41 -0000
@@ -55,6 +55,7 @@
builtins = {
'cwd':os.path.abspath(os.getcwd()),
+ 'userhome':os.path.expanduser('~'),
'username':pwd.getpwuid(os.getuid())[0],
'buildoutdir':buildoutdir,
'platform':platform
Then you could refer to ${userhome} within expressions in your .ini files and task expandables.
This is not the most generic fix, but it does no harm. I'll check it in as you see above, so your scripts should continue to work after the next release.
The "right thing" to do here is probably to make buildit expand tildes in targets, the workdir, and shell commands.
________________________________________
= Request - Entry #1 by Anonymous User on Aug 13, 2007 7:56 pm
On Aug 13, 2007, at 3:28 PM, Shenton Chris wrote (via buildit list):
I've started to use buildit for a project here and have been compiling a bunch of notes and gotchas. One thing that's stumped me now is how to specify a location under the user's home dir.
I have a target to download something by SVN into a directory under the user's home directory, but first want to ensure the directory exists; the dir is specified in a .ini file like ~/msrd_src. I create a dependency task that creates the dir and that expands the tilde fine as it's executing in a shell, but the check for the target fails because the ~ isn't getting expanded by python when it's looking for it. Here, install_product_dir is ~/msrd_src, gotten from a .ini file.
ensure_install_dir = Task(
"msrd ensure install dir",
dependencies = [],
namespaces = 'msrd',
targets = ${./install_product_dir}",
workdir = '${builddir}',
commands = (
"mkdir -p ${./install_product_dir}",
)
)
It fails looking for the target after creation. If I try to expand it with:
targets = os.path.expanduser("${./install_product_dir}"),
that fails too:
Relative target '~/msrd_src' specified without a working directory
There's probably some stupid/obvious/easy way to work around this but I can't find it. I see there are pre-defined variables like ${username} but ${home} doesn't exist or I could use that.
Any clues for a clueless newbie to buildit?
Thanks.
|
|
|