= Reject - Entry #2 by chrism on Jul 27, 2007 7:44 pm
Status: Pending => Rejected
Hi Jeff,
The error you're seeing is due to the fact that even if you're populating a "globals" section, you have to reference the "current section" using "./" within bracketed names to refer to another variable in the same section, e.g.:
[globals]
foo=bar
baz=${./foo}
as opposed to
[globals]
foo=bar
baz=${foo}
Only "builtin" names (currently "cwd", "username", "buildoutdir" and "platform") can be referenced without a "./" anywhere.
Working example:
import context
f = open('jefftest.ini', 'w')
f.write("[globals]\nfoo=bar\nbaz=${./foo}\n")
f.close()
c = context.Context('jefftest.ini')
print c.globals
________________________________________
= Request - Entry #1 by Anonymous User on Apr 30, 2007 1:39 pm
You cannot base one global variable off of another. Maybe it is by design, but it seems to behave badly:
>>> from buildit import context
>>> from StringIO import StringIO
>>> c = context.Context(StringIO("[globals]\nfoo=bar\nbaz=${foo}\n"))
No [globals] section in inifile <StringIO.StringIO instance at 0x2b58671d4320>
No [namespaces] section in inifile <StringIO.StringIO instance at 0x2b58671d4320>
>>> c.globals
{'username': 'jhammel', 'platform': 'linux-x86_64', 'buildoutdir': '/home/jhammel', 'cwd': '/home/jhammel'}
>>> c.interpolate('${baz}', None)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib64/python2.4/site-packages/buildit/context.py", line 138, in interpolate
task)
File "/usr/lib64/python2.4/site-packages/buildit/resolver.py", line 211, in resolve_value
name)
buildit.resolver.MissingDependencyError: <MissingDependencyError in section named None, option named None, value '${baz}', offender 'baz'>
FYI, I have tried to contact you via email, but it seems my mail gets rejected on the basis of being spam.
|
|