I know it's been a while since you announced this, but I'm just looking into this now. My primary interest is having a build script that selects the correct c++ compiler and get around a long-standing distutils bug.
I'm running into a little speed bump here. It's failing on the pkg-config detection of gtk. I have user-locally built and installed packages for gtk (and many other things), so I set my PKG_CONFIG_PATH to a custom location. However, it appears that scons isn't passing this along to 'pkg-config'. By poking into scons.Action._subproc, it looks like it is only passing a limited set of environment variables ("PATH", "LD_LIBRARY_PATH" and "HOME") to the pkg-config subprocess. Is there an scons way to get it to use this environment variable?
Mike
> python setupscons.py build
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "matplotlib" sources
build_src: building npy-pkg config files
running build_py
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
running scons
customize UnixCCompiler
Found executable /usr/bin/gcc
customize GnuFCompiler
Found executable /usr/bin/g77
gnu: no Fortran 90 compiler found
customize GnuFCompiler
gnu: no Fortran 90 compiler found
Found executable /usr/bin/g77
customize UnixCCompiler
customize UnixCCompiler using scons
Found executable /usr/bin/g++
Executing scons command (pkg is matplotlib): /home/mdroe/usr/bin/python "/home/mdroe/usr/lib/python2.5/site-packages/numscons/scons-local/scons.py" -f SConstruct -I. scons_tool_path="" src_dir="" pkg_path="lib/matplotlib" pkg_name="matplotlib" log_level=50 distutils_libdir="../../../build/lib.linux-i686-2.5" distutils_clibdir="../../../build/temp.linux-i686-2.5" distutils_install_prefix="/home/mdroe/usr/lib/python2.5/site-packages/matplotlib" cc_opt=gcc cc_opt_path="/usr/bin" debug=0 f77_opt=g77 f77_opt_path="/usr/bin" cxx_opt=g++ cxx_opt_path="/usr/bin" include_bootstrap=/home/mdroe/usr/lib/python2.5/site-packages/numpy/core/include bypass=0 import_env=0 silent=0 bootstrapping=0
scons: Reading SConscript files ...
Mkdir("build/scons/matplotlib")
Checking for freetype2 ... Yes
Checking for png ... Yes
Package pygtk-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pygtk-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pygtk-2.0' found
OSError: 'pkg-config pygtk-2.0 gtk+-2.0 --cflags' exited 1:
File "/wonkabar/data1/builds/matplotlib_scons/SConstruct", line 2:
GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
File "/home/mdroe/usr/lib/python2.5/site-packages/numscons/core/numpyenv.py", line 135:
build_dir = '$build_dir', src_dir = '$src_dir')
File "/wonkabar/data1/usr/lib/python2.5/site-packages/numscons/scons-local/scons-local-1.2.0/SCons/Script/SConscript.py", line 553:
return apply(_SConscript, [self.fs,] + files, subst_kw)
File "/wonkabar/data1/usr/lib/python2.5/site-packages/numscons/scons-local/scons-local-1.2.0/SCons/Script/SConscript.py", line 262:
exec _file_ in call_stack[-1].globals
File "/wonkabar/data1/builds/matplotlib_scons/build/scons/matplotlib/SConscript", line 271:
if not config.CheckPyGTK():
File "/wonkabar/data1/usr/lib/python2.5/site-packages/numscons/scons-local/scons-local-1.2.0/SCons/SConf.py", line 650:
ret = apply(self.test, (context,) + args, kw)
File "/wonkabar/data1/builds/matplotlib_scons/build/scons/matplotlib/SConscript", line 132:
pkg_config_cmd, autoadd=autoadd)
File "/wonkabar/data1/builds/matplotlib_scons/build/scons/matplotlib/SConscript", line 249:
return check_from_pkg_config(context, cmd_base, src, autoadd=autoadd)
File "/wonkabar/data1/builds/matplotlib_scons/build/scons/matplotlib/SConscript", line 61:
compile_info = context.env.ParseFlags([' '.join(cflags_cmd)])
File "/wonkabar/data1/usr/lib/python2.5/site-packages/numscons/scons-local/scons-local-1.2.0/SCons/Environment.py", line 791:
do_parse(arg, do_parse)
File "/wonkabar/data1/usr/lib/python2.5/site-packages/numscons/scons-local/scons-local-1.2.0/SCons/Environment.py", line 672:
for t in arg: me(t, me)
File "/wonkabar/data1/usr/lib/python2.5/site-packages/numscons/scons-local/scons-local-1.2.0/SCons/Environment.py", line 677:
arg = self.backtick(arg[1:])
File "/wonkabar/data1/usr/lib/python2.5/site-packages/numscons/scons-local/scons-local-1.2.0/SCons/Environment.py", line 593:
raise OSError("'%s' exited %d" % (command, status))
Checking for pygtk >= (2, 2, 0) ... error: Error while executing scons command. See above for more information.
If you think it is a problem in numscons, you can also try executing the scons
command with --log-level option for more detailed output of what numscons is
doing, for example --log-level=0; the lowest the level is, the more detailed
the output it.
David Cournapeau wrote:
···
Hi,
I don't know if that's of any interest for matplotlib developers,
but I added scripts to build matplotlib with numscons:
http://github.com/cournape/matplotlib/tree/scons_build
Not every configuration is supported yet, but I can successfully build
matplotlib on Linux with gtk or wx backends. It only adds 3 files + one
configuration example, and does not touch any other file.
The advantage of numscons over distutils is automatic dependency
handling (no need to rm -rf build to get accurate build), easy compiler
flags customization, parallel build, etc... There are some instructions
in setupscons.py.
It is still experimental (I have not implemented check for QT, as well
as windows, macosx and qt backends), but it seems to work well. I will
add mac os x and windows backends soon (I started this to debug issues
on 64 bits version of matplotlib),
cheers,
David
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA