Re: Importing Cheetah.Template.Template unusually slow?

Michael Higgins <[email protected]> Tue, 9 Mar 2010 15:05:51 -0500
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
Just downloaded the tarball from http://pypi.python.org/pypi/Cheetah/2.4.2.1 
  and I'm seeing similar compile problems to the ones reported below.

I'm on OS X 10.5.8, using python 2.5.1.  When I unpack the tarball and  
do python setup.py build, it spits out this:

...
building 'Cheetah._namemapper' extension
creating build/temp.macosx-10.5-i386-2.5
creating build/temp.macosx-10.5-i386-2.5/cheetah
creating build/temp.macosx-10.5-i386-2.5/cheetah/c
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused- 
madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes - 
DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe - 
I/System/Library/Frameworks/Python.framework/Versions/2.5/include/ 
python2.5 -c cheetah/c/_namemapper.c -o build/temp.macosx-10.5- 
i386-2.5/cheetah/c/_namemapper.o
cheetah/c/_namemapper.c: In function ‘setNotFoundException’:
cheetah/c/_namemapper.c:38: warning: implicit declaration of function  
‘PyUnicode_FromFormat’
cheetah/c/_namemapper.c:38: warning: assignment makes pointer from  
integer without a castcheetah/c/_namemapper.c: In function  
‘setNotFoundException’:
cheetah/c/_namemapper.c:38: warning: implicit declaration of function  
‘PyUnicode_FromFormat’
cheetah/c/_namemapper.c:38: warning: assignment makes pointer from  
integer without a cast

cheetah/c/_namemapper.c: In function  
‘wrapInternalNotFoundException’:cheetah/c/_namemapper.c: In function  
‘wrapInternalNotFoundException’:
cheetah/c/_namemapper.c:62: warning: assignment makes pointer from  
integer without a cast
cheetah/c/_namemapper.c:62: warning: assignment makes pointer from  
integer without a cast

gcc -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc  
build/temp.macosx-10.5-i386-2.5/cheetah/c/_namemapper.o -o build/ 
lib.macosx-10.5-i386-2.5/Cheetah/_namemapper.so
...

and then the C version of the namemapper doesn't import because of  
missing symbols.

Is there another build out there that fixes this, or is it still in  
the pipeline?

(And thanks for all your hard work!  Cheetah is great!)

Mike



On Feb 1, 2010, at 10:53 PM, R. Tyler Ballance wrote:

>
> On Tue, 02 Feb 2010, Matthew Beauregard wrote:
>
>>> Your workaround is fine, but you might want to look into why
>>> you're not using
>>> the compiled namemapper
>>
>> Actually, yeah, that's just bit me.  There is (and has been for
>> years) a difference between the C and Python NameMappers that my
>> code triggers so parts of it only work with the C mapper.  That's
>> been fine until now when I'm trying to build from git/next.
>
> Ah yes indeed, this is another thing I've messed up in the next  
> branch and
> haven't had a chance to fix yet :)
>
> I made a good chunk of changes without checking Hudson to see how  
> they were
> performing on other versions of Python and other platforms. This  
> past weekend I
> went back to Hudson and realized my error.
>
> You can check out the current build results here:
>    http://avocado.monkeypox.org:8080/job/Cheetah_next/
>
> My apologies, I typically work under Python 2.6 so I was completely  
> oblivious
> to the breakages on Python 2.4 and 2.5
>
> I'll probably fix it tonight or tomorrow sometime; I'll update the  
> thread when
> it's there
>
>>
>> From what I can see the compiled mapper isn't building right for me:
>>
>> gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
>> -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall
>> -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE
>> -arch i386 -arch ppc -pipe -
>> I/System/Library/Frameworks/Python.framework/Versions/2.5/include/
>> python2.5 -c cheetah/c/_namemapper.c -o build/temp.macosx-10.5-
>> i386-2.5/cheetah/c/_namemapper.o
>> cheetah/c/_namemapper.c: In function ?setNotFoundException?:
>> cheetah/c/_namemapper.c:38: warning: implicit declaration of
>> function ?PyUnicode_FromFormat?
>> cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
>> integer without a cast
>> cheetah/c/_namemapper.c: In function ?setNotFoundException?:
>> cheetah/c/_namemapper.c:38: warning: implicit declaration of
>> function ?PyUnicode_FromFormat?
>> cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
>> integer without a cast
>> cheetah/c/_namemapper.c: In function ?wrapInternalNotFoundException?:
>> cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
>> integer without a cast
>> cheetah/c/_namemapper.c: In function ?wrapInternalNotFoundException?:
>> cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
>> integer without a cast
>>
>> So then I get:
>>
>>>>> from Cheetah._namemapper import NotFound, valueForKey,  
>>>>> valueForName
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>> ImportError: dlopen(/Library/Python/2.5/site-packages/Cheetah-2.4.2-
>> py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so, 2): Symbol not
>> found: _PyUnicode_FromFormat
>>  Referenced from: /Library/Python/2.5/site-packages/Cheetah-2.4.2-
>> py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so
>>  Expected in: dynamic lookup
>>
>> thanks,
>> Matthew
>>
> Cheers,
> -R. Tyler Ballance
> --------------------------------------
> Jabber: [email protected]
> GitHub: http://github.com/rtyler
> Twitter: http://twitter.com/agentdero
>   Blog: http://unethicalblogger.com
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the  
> business
> Choose flexible plans and management services without long-term  
> contracts
> Personal 24x7 support from experience hosting pros just a phone call  
> away.
> http://p.sf.net/sfu/theplanet-com_______________________________________________
> Cheetahtemplate-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev