Bug 9503 - waf assumes that pythonX.Y-config is a Python script
Summary: waf assumes that pythonX.Y-config is a Python script
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.0.0rc5
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Blocks: 9306
  Show dependency treegraph
Reported: 2012-12-14 11:03 UTC by Martin Pitt
Modified: 2013-01-28 19:05 UTC (History)
2 users (show)

See Also:

Do not assume that python*-config is a Python script; just call it as an executable (867 bytes, patch)
2012-12-14 11:05 UTC, Martin Pitt
no flags Details
Patch for v4-0-test (966 bytes, patch)
2013-01-27 14:06 UTC, Stefan Metzmacher
abartlet: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Pitt 2012-12-14 11:03:06 UTC
buildtools/wafadmin/Tools/python.py currently calls the detected pythonX.Y-config through the detected $PYTHON interpreter. This assumes that pythonX.Y-config is actually a Python script, but it should just be called as an executable.

Our Python maintainer, Matthias Klose, recently changed pythonX.Y-config to be a shell script to better support cross-building; he said that he will push for this to land in upstream Python as well.

As a result of that, configuring fails with:

--------------------- 8< -----------------
Checking for Python version >= 2.4.2                                              : ok 2.7.3 
Checking for library python2.7                                                    : yes 
Checking for program python2.7-config                                             : "/usr/bin/python2.7-config" 
  File "/usr/bin/python2.7-config", line 5
    echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--configdir"
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "./buildtools/bin/waf", line 76, in <module>
    Scripting.prepare(t, cwd, VERSION, wafdir)
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/buildtools/wafadmin/Scripting.py", line 145, in prepare
    prepare_impl(t, cwd, ver, wafdir)
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/buildtools/wafadmin/Scripting.py", line 135, in prepare_impl
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/wscript", line 281, in main
  File "./buildtools/wafsamba/samba_wildcard.py", line 110, in wildcard_main
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/buildtools/wafadmin/Scripting.py", line 241, in configure
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/buildtools/wafadmin/Configure.py", line 237, in sub_config
    self.recurse(k, name='configure')
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/buildtools/wafadmin/Utils.py", line 634, in recurse
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/wscript", line 92, in configure
  File "./buildtools/wafsamba/samba_python.py", line 11, in SAMBA_CHECK_PYTHON_HEADERS
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/buildtools/wafadmin/Tools/python.py", line 262, in check_python_headers
    for incstr in Utils.cmd_output("%s %s --includes" % (python, python_config)).strip().split():
  File "/build/buildd/samba4-4.0.0~rc5+dfsg1/buildtools/wafadmin/Utils.py", line 455, in cmd_output
    raise ValueError(msg)
ValueError: command execution failed: /usr/bin/python2.7 "/usr/bin/python2.7-config" --includes -> ''

--------------------- 8< -----------------
Comment 1 Martin Pitt 2012-12-14 11:05:01 UTC
Created attachment 8346 [details]
Do not assume that python*-config is a Python script; just call it as an executable

This patch drops the assumption of the -config script being a Python script, and just calls it as an executable. This should be more robust, and works:


built on all architectures (you can click through the build logs if you are interested).

Thanks for considering!
Comment 2 Andrew Bartlett 2012-12-31 08:23:44 UTC
This change appears to be in master.  Should we backport it to 4.0?
Comment 3 Stefan Metzmacher 2013-01-27 14:06:41 UTC
Created attachment 8500 [details]
Patch for v4-0-test
Comment 4 Karolin Seeger 2013-01-28 10:15:56 UTC
Pushed to autobuild-v4-0-test.
Comment 5 Karolin Seeger 2013-01-28 19:05:56 UTC
Pushed to v4-0-test.
Closing out bug report.