Loading ...
Sorry, an error occurred while loading the content.

[Cheetahtemplate-discuss] Compiling _namewrapper.c against Python 2.4

Expand Messages
  • Fred Ludlow
    Hi, I think an oldish bug has resurfaced (see http://web.archiveorange.com/archive/v/GBNPV1aKn5iohvd2oUFP). I just tried to build Cheetah 2.4.3 on a CentOS 5
    Message 1 of 4 , Nov 2, 2010
    • 0 Attachment
      Hi,

      I think an oldish bug has resurfaced (see http://web.archiveorange.com/archive/v/GBNPV1aKn5iohvd2oUFP). I just tried to build Cheetah 2.4.3 on a CentOS 5 virtual server running python 2.4 and couldn't compile _namewrapper.c as PyUnicode_FromFormat isn't defined for python 2.4. 

      I've sort of fixed this (in the sense it now builds, can import _namewrapper and runs without warnings) by

      1) adding the macro definition suggested in the above thread to cheetah/c/cheetah.h 
      ie.
      #ifndef PyUnicode_FromFormat
      #define PyUnicode_FromFormat(a,b) PyString_FromFormat(a,b)
      #endif

      2) Changing the call to this macro in _namewrapper.c line 61 to only take 2 arguments (However, I did this just by ditching the 2nd argument (excValue) and removing the relevant '%U' from the format string, ie. the line now reads:
      newExcValue = PyUnicode_FromFormat("Exception while searching for \'%s\'",fullName);

      I'm not familiar with the Python C API (or C really), so not really sure what the best (and probably very simple) way to fix this properly is, but thought this might provide some help for anyone in a similar position.

      Cheers,

      Fred
    • R. Tyler Croy
      ... What version of Python 2.4 is this? I m building the current release just fine on Python 2.4.6/amd64. ... - R. Tyler Croy ... GitHub:
      Message 2 of 4 , Nov 2, 2010
      • 0 Attachment
        On Tue, 02 Nov 2010, Fred Ludlow wrote:

        > Hi,
        >
        > I think an oldish bug has resurfaced (see
        > http://web.archiveorange.com/archive/v/GBNPV1aKn5iohvd2oUFP). I just tried
        > to build Cheetah 2.4.3 on a CentOS 5 virtual server running python 2.4 and
        > couldn't compile _namewrapper.c as PyUnicode_FromFormat isn't defined for
        > python 2.4.


        What version of Python 2.4 is this? I'm building the current release just fine
        on Python 2.4.6/amd64.




        > I've sort of fixed this (in the sense it now builds, can import _namewrapper
        > and runs without warnings) by
        >
        > 1) adding the macro definition suggested in the above thread to
        > cheetah/c/cheetah.h
        > ie.
        > #ifndef PyUnicode_FromFormat
        > #define PyUnicode_FromFormat(a,b) PyString_FromFormat(a,b)
        > #endif
        >
        > 2) Changing the call to this macro in _namewrapper.c line 61 to only take 2
        > arguments (However, I did this just by ditching the 2nd argument (excValue)
        > and removing the relevant '%U' from the format string, ie. the line now
        > reads:
        > newExcValue = PyUnicode_FromFormat("Exception while searching for
        > \'%s\'",fullName);
        >
        > I'm not familiar with the Python C API (or C really), so not really sure
        > what the best (and probably very simple) way to fix this properly is, but
        > thought this might provide some help for anyone in a similar position.
        >
        > Cheers,
        >
        > Fred

        > ------------------------------------------------------------------------------
        > Nokia and AT&T present the 2010 Calling All Innovators-North America contest
        > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
        > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
        > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
        > http://p.sf.net/sfu/nokia-dev2dev

        > _______________________________________________
        > Cheetahtemplate-discuss mailing list
        > Cheetahtemplate-discuss@...
        > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

        - R. Tyler Croy
        --------------------------------------
        GitHub: http://github.com/rtyler
        Twitter: http://twitter.com/agentdero
      • Fred Ludlow
        ... Python 2.4.3 (#1, Sep 3 2009, 15:37:12) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 ... Achieve Improved Network Security with IP and DNS
        Message 3 of 4 , Nov 2, 2010
        • 0 Attachment

          What version of Python 2.4 is this? I'm building the current release just fine
          on Python 2.4.6/amd64.


          Python 2.4.3 (#1, Sep  3 2009, 15:37:12)
          [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2


        • R. Tyler Croy
          ... Good to know, I ll update my local 2.4 version and give this a whirl tonight. As somebody who deploys on RHEL, I highly recommend finding Python packages
          Message 4 of 4 , Nov 3, 2010
          • 0 Attachment
            On Wed, 03 Nov 2010, Fred Ludlow wrote:

            > >
            > >
            > > What version of Python 2.4 is this? I'm building the current release just
            > > fine
            > > on Python 2.4.6/amd64.
            > >
            > >
            > Python 2.4.3 (#1, Sep 3 2009, 15:37:12)
            > [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2


            Good to know, I'll update my local 2.4 version and give this a whirl tonight.


            As somebody who deploys on RHEL, I highly recommend finding Python packages
            elsewhere, RH is lethargic at best with Python package updates :-/

            - R. Tyler Croy
            --------------------------------------
            GitHub: http://github.com/rtyler
            Twitter: http://twitter.com/agentdero
          Your message has been successfully submitted and would be delivered to recipients shortly.