Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 364629

Summary: waf supplied with net-libs/nodejs-0.4.6 and 0.4.7 fails if python3 selected
Product: Gentoo Linux Reporter: JokeyRhyme <jokeyrhyme>
Component: [OLD] DevelopmentAssignee: Patrick Lauer <patrick>
Status: RESOLVED FIXED    
Severity: minor CC: alexander, drobbins, schamane
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log showing waf script error
output of emerge --info on my system
new nodejs-0.6.0.ebuild that would fix the python problems
new nodejs-0.6.0.ebuild that would fix the python problems

Description JokeyRhyme 2011-04-24 06:11:49 UTC
waf (http://code.google.com/p/waf/) is supplied as part of the nodejs build package. While it officially supports Python 3.2, the version included with nodejs fails whenever Python 3.x is the currently active Python.

Reproducible: Always

Steps to Reproduce:
1. emerge python 3.x.x
2. eselect python set x (where x is your python 3)
3. emerge nodejs
Actual Results:  
emerge fails with a waf configuration script error

Expected Results:  
emerge should succeed

If you use eselect python set x (where x is python 2.7.x) then the emerge completes successfully.

If it is possible, I think changing the ebuild to require Python 2.x would be a good idea. It is likely that an upstream update will eventually include a better version of waf.
Comment 1 JokeyRhyme 2011-04-24 06:13:39 UTC
Created attachment 270991 [details]
build.log showing waf script error
Comment 2 JokeyRhyme 2011-04-24 06:15:17 UTC
Created attachment 270993 [details]
output of emerge --info on my system
Comment 3 JokeyRhyme 2011-04-24 06:16:03 UTC
Summary of build.log:
>>> Configuring source in /var/tmp/portage/net-libs/nodejs-0.4.7/work/node-v0.4.7 ...
Traceback (most recent call last):
  File "/var/tmp/portage/net-libs/nodejs-0.4.7/work/node-v0.4.7/tools/waf-light", line 157, in <module>
    import Scripting
  File "/var/tmp/portage/net-libs/nodejs-0.4.7/work/node-v0.4.7/tools/wafadmin/Scripting.py", line 146
    except Utils.WafError, e:
                         ^
SyntaxError: invalid syntax
Comment 4 JokeyRhyme 2011-04-24 06:22:43 UTC
A bug report on node.js tracker from the Arch Linux team:
https://github.com/joyent/node/issues/501

This includes a potential patch that may allow node.js to be built with Python 3.
Comment 5 Daniel Robbins 2011-08-17 16:51:59 UTC
for now you can get nodejs building reliably by adding this:


+src_prepare() {
+       cd ${S}
+       for x in $(grep -r "/usr/bin/env python" * | cut -f1 -d":" ); do
+               einfo "Tweaking $x for python2..."
+               sed -e "s:/usr/bin/env python:/usr/bin/env python2:g" -i $x || die
+       done
+       sed -e "s/python/python2/g" -i Makefile || die
+}
+

This hard-codes use of python2, which is what nodejs requires.

Then add =dev-lang/python-2* to DEPEND and RDEPEND.
Comment 6 Alexander Sulfrian 2011-11-10 23:56:33 UTC
Created attachment 292165 [details]
new nodejs-0.6.0.ebuild that would fix the python problems

The attached ebuild would fix the python problems using the python.eclass.
Comment 7 Alexander Sulfrian 2011-11-10 23:59:55 UTC
Created attachment 292167 [details]
new nodejs-0.6.0.ebuild that would fix the python problems

This used the ebuild from official portage as template.
Comment 8 Patrick Lauer gentoo-dev 2012-02-20 13:20:40 UTC
+  20 Feb 2012; Patrick Lauer <patrick@gentoo.org> nodejs-0.6.11.ebuild:
+  Restrict python to 2.*
Comment 9 Alexander Sulfrian 2012-02-22 02:45:36 UTC
The committed change, does not fix the bug. It only add the python 2 dependency. But if python 3 is the system default python version, the ebuild fails during configuring.

Maybe you want to take a look at the attached ebuild, how to properly fix it.