[Scons-users] Trouble with AutoConfigBuilder

Marc Branchaud marcnarc at xiplink.com
Tue Mar 10 13:21:52 EDT 2015


On 15-03-09 04:12 PM, Jonathon Reinhart wrote:
> I'm trying to get AutoConfigBuilder
> <https://bitbucket.org/scons/scons/wiki/AutoConfigBuilder> working, but I'm
> having no luck.  I'm using SCons v2.3.4.
> 
> My SConstruct:
> 
> env = Environment(tools = ['default','UnTar','AutoConfig'])
> configured = env.AutoConfig('libpcap-1.6.2')

Unfortunately the AutoConfigBuilder is a bit primitive.  The problem is
exactly as you say below: it thinks libpcap-1.6.2 is a file.

To make it work, you need to give it a Dir object:
	configured = env.AutoConfig(Dir('libpcap-1.6.2'))

More elegantly, the AutoConfigBuilder should declare that its source is a Dir
object, by adding a "source_factory = Dir" parameter in the generator:

	def generate(env, **kwargs):
	    env['BUILDERS']['AutoConfig'] = env.Builder(
	        action = env.Action(builder, message),
	        emitter = emitter,
	        source_factory = Dir,
	        single_source = True)

Hope that helps!

		M.

> Output:
> 
> scons: Reading SConscript files ...
> TypeError: Tried to lookup Dir 'libpcap-1.6.2' as a File.:
>   File "/home/jreinhart/git_repos/scons-test/autoconf_builder/SConstruct",
> line 4:
>     configured = env.AutoConfig('libpcap-1.6.2')
>   File "/usr/lib/scons/SCons/Environment.py", line 260:
>     return MethodWrapper.__call__(self, target, source, *args, **kw)
>   File "/usr/lib/scons/SCons/Environment.py", line 224:
>     return self.method(*nargs, **kwargs)
>   File "/usr/lib/scons/SCons/Builder.py", line 633:
>     return self._execute(env, target, source, OverrideWarner(kw), ekw)
>   File "/usr/lib/scons/SCons/Builder.py", line 554:
>     tlist, slist = self._create_nodes(env, target, source)
>   File "/usr/lib/scons/SCons/Builder.py", line 484:
>     slist = env.arg2nodes(source, source_factory)
>   File "/usr/lib/scons/SCons/Environment.py", line 486:
>     v = node_factory(self.subst(v, **kw))
>   File "/usr/lib/scons/SCons/Node/FS.py", line 1340:
>     return self._lookup(name, directory, File, create)
>   File "/usr/lib/scons/SCons/Node/FS.py", line 1319:
>     return root._lookup_abs(p, fsclass, create)
>   File "/usr/lib/scons/SCons/Node/FS.py", line 2224:
>     result.must_be_same(klass)
>   File "/usr/lib/scons/SCons/Node/FS.py", line 627:
>     (self.__class__.__name__, self.path, klass.__name__))
> 
> Any advice on how to start working on this recipe? I'm not even sure what
> exactly is failing here. I'm assuming for some reason SCons thinks that when
> I call the builder like env.AutoConfig('libpcap-1.6.2'), that I'm referring
> to a file, not a directory.
> 
> 
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> 


More information about the Scons-users mailing list