views:

127

answers:

2

I cloned the node git repo but the "waf" build tool that comes with node seems to not work with the latest version of Python.

$ ./configure
Traceback (most recent call last):
  File "/Users/greim/nodestuff/node/tools/waf-light", line 157, in <module>
    import Scripting
  File "/Users/greim/nodestuff/node/tools/wafadmin/Scripting.py", line 146
    except Utils.WafError, e:
                         ^
SyntaxError: invalid syntax
$ which python
/Library/Frameworks/Python.framework/Versions/3.0/bin/python

If I understand, that comma is an outdated syntax that doesn't work on Python 3, right?

I'd rather not install an old version of Python just to do this. Ideally I'd like to be able to build and install the latest version, rather than depend on others to distribute .dmg files.

Rock and hard place? Recommendations?


[update] OK, so thanks to all who helped answer this question. Hopefully others will find this on Google. As it turns out I do have Python 2.x on my system (it comes installed by default on OS X) under /usr/bin. So the solution was to update my path (not permanently, just for this one bash session).

$ export PATH=/usr/bin:$PATH
$ ./configure
$ make
$ make install

Tada! Node is installed on my system.

+1  A: 

Yes the coma is outdated: see http://www.python.org/dev/peps/pep-3110/

Unfortunately, there's not much solution, if you stick with python3 you will have to modify the node code to make it work.

hellvinz
+1  A: 

Ithe waf project page says

Compatibility from Python 2.3 to 3.1 is maintained (and Jython 2.5)

I think it currently does this by running 2to3.py when unpacking so if you had run first with python2 then it might be wrong. The waf1.6 branch I think is python3 clean

Reading the node.js code the node people expanded waf - which is not how you are meant to use waf. The idea is put the waf binary in the source code - this will expand using the correct version of python

OSX does have python 2 so a way of running the build might be to edit the root makefile and replace the first line

WAF=python tools/waf-light

by

WAF=/usr/bin/python tools/waf-light
Mark
Well I typed /user/bin/python on my terminal and by golly, there was python 2.6.1. Who knew. (Apparently you did.) Thanks.
greim
Yes so solving the problem was a simple matter of updating my PATH so that /user/bin was first.
greim
You probably out to report this as a bug to node
Mark