Unexpected python exception

Tino Wildenhain tino at wildenhain.de
Fri Nov 13 12:52:04 EST 2009


Am 11.11.2009 15:29, schrieb Richard Purdie:
> On Wed, 2009-11-11 at 05:04 -0800, Chris Rebert wrote:
>> On Wed, Nov 11, 2009 at 4:37 AM, Richard Purdie<rpurdie at rpsys.net>  wrote:
>> <snip>
>>> Is there a way to make the "global x" apply to all functions without
>>> adding it to each one?
>>
>> Thankfully, no.
>
> Hmm :(.
>
>>> What I'm trying to do is to avoid having "import X" statements
>>> everywhere by changing __builtin__. It seems my approach doesn't have
>>> quite the same effect as a true import though.
>>
>> And you can't just put all your imports together at the top of the
>> file because...?
>
> The application in question is bitbake, the parsing tool for the
> OpenEmbedded and Poky projects.
>
> We're talking about python code fragments spread across about 8,000
> files which make up the "metadata" some of which is public and some of
> which is not. Rightly or wrongly bitbake does some interesting things
> with its execution contexts for these code fragments.

And you can't just use __import__() to programmatically include some
of the fragments instead of having this local/global weirdness in
funtions in those modules?

> Lets just say its not a traditional use case, we know the way bitbake
> does some things is evil but it does other things rather well and we
> can't break those.

I'd need to see the bigger picture because I don't know of bitbake but I
have a feeling this can be done much nicer in the end.

Regards
Tino

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3254 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20091113/12e0cd2e/attachment-0001.bin>


More information about the Python-list mailing list