[Scons-users] TryAction ('pkgconfig ..') and PRINT_CMD_LINE_FUNC => exception.

Jos De Laender jos at de-laender.be
Sun Dec 9 18:09:24 EST 2012


Dear all,

I'm a new and happy user of Scons.
I managed to build and crossbuild a Qt project of mine using Scons,
something I didn't manage with CMake.

However, now lately I'm experiencing a strange and nasty issue.
I read about already on Google, but neither do I find the solution, nor
can I solve it myself.

I have a detector for pkg-config, along the lines of what's on the wiki.

When I install then also a PRINT_CMD_LINE_FUNC, (and remove the .db
stuff) I get an exception error in config.log (and the test fails).

The really weird thing is that I have no issue as long as I don't write
anything to stdout in PRINT_CMD_LINE_FUNC
Thus writing the command to a file within PRINT_CMD_LINE_FUNC and
returning works. As soon as I write something to stdout (via print, sys
...) the issue occurs.

Also, when I postpone install of PRINT_CMD_LINE_FUNC until after the
pkg-config checks, I have no single issue on a complete build.

I don't get it ... (and I'm new to python as well).

Clues ?

My Scons :

/usr/local/bin/scons
jos at debian:~/dlEmu8080$ scons --version
SCons by Steven Knight et al.:
script: v2.2.0.issue-2856:2676:d23b7a2f45e8[MODIFIED], 2012/08/05
15:38:28, by garyo on oberbrunner-dev
engine: v2.2.0.issue-2856:2676:d23b7a2f45e8[MODIFIED], 2012/08/05
15:38:28, by garyo on oberbrunner-dev
engine path: ['/usr/local/lib/scons-2.2.0/SCons']
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011, 2012 The SCons Foundation

My Python : 2.6.6 on Debian.

>>> LOG
file
/media/Sata_Data/JosDistroIndependentData/SoftwareUnderDevelopment/dlEmu8080/SConstruct,line
220:
Configure(confdir = .sconf_temp)
scons: Configure: Caught exception while building ".sconf_temp/conftest_0":

Traceback (most recent call last):
File "/usr/local/lib/scons-2.2.0/SCons/Job.py", line 201, in start
task.execute()
File "/usr/local/lib/scons-2.2.0/SCons/SConf.py", line 352, in execute
raise e
TypeError: can't write str to text stream
scons: Configure: no
>>> END LOG


>>> CODE
def dlCheckPKGConfig(Context,MinVersion):
dlPkgConfig = Context.env['DL_CROSS'] + 'pkg-config'
print dlBoldBlue + 'Checking for \'' + dlPkgConfig + '\' ... ' +
dlNoAttrs
Ret=Context.TryAction(
dlPkgConfig + ' --atleast-pkgconfig-version=' + MinVersion)[0]
Context.Result(Ret)
print "FOOBAR :" + str(Ret)
return Ret
>>> END CODE

Called as in the wiki :

>>> CODE
dlConf = Configure(dlDefaultEnv,
custom_tests = {'dlCheckPKGConfig' : dlCheckPKGConfig,
'dlCheckPKG' : dlCheckPKG })

if not dlConf.dlCheckPKGConfig('0.25'):
dlPrintLog(dlLogFile,dlBoldRed,'pkg-config >= 0.25 not found.')
dlPrintLog(dlLogFile,dlBoldRed,'Giving up.')
Exit(1)
>>> END CODE



--
Jos De Laender
www.jodela.be



More information about the Scons-users mailing list