[Scons-dev] proposed change to _SConscript

Jason Kenny dragon512 at live.com
Mon Jan 28 18:22:32 EST 2019


Ya.. I mentioned that the code I was using is a feature that was removed from documentation. I think now the reason it was removed was because people got confused on what was going on..

The original sconscript ( and  a feature I have used in Parts since day 1) looks like this:
https://scons.org/doc/1.0.0/HTML/scons-man.html

The text below:
------------
SConscript(scripts, [exports, variant_dir, src_dir, duplicate])
env.SConscript(scripts, [exports, variant_dir, src_dir, duplicate])
SConscript(dirs=subdirs, [name=script, exports, variant_dir, src_dir, duplicate])
env.SConscript(dirs=subdirs, [name=script, exports, variant_dir, src_dir, duplicate])
This tells scons to execute one or more subsidiary SConscript (configuration) files. There are two ways to call the SConscript() function.
The first way you can call SConscript() is to explicitly specify one or more scripts as the first argument. A single script may be specified as a string; multiple scripts must be specified as a list (either explicitly or as created by a function like Split()).

The second way you can call SConscript() is to specify a list of (sub)directory names as a dirs=subdirs keyword argument. In this case, scons will, by default, execute a subsidiary configuration file named SConscript in each of the specified directories. You may specify a name other than SConscript by supplying an optional name=script keyword argument.

The optional exports argument provides a list of variable names or a dictionary of named values to export to the script(s). These variables are locally exported only to the specified script(s), and do not affect the global pool of variables used by the Export() function. The subsidiary script(s) must use the Import() function to import the variables.

If the optional variant_dir argument is present, it causes an effect equivalent to VariantDir( variant_dir, src_dir, duplicate) to be executed prior to reading the script(s). (If variant_dir is not present, the src_dir and duplicate arguments are ignored.) The variant_dir and src_dir arguments are interpreted relative to the directory of the calling SConscript file. If src_dir is not specified, the directory of the calling SConscript file is assumed. See the description of the VariantDir() function below for additional details and restrictions.

Any variables returned by script using Return() will be returned by the call to SConscript().
...
-------

This code basically allowed one to control the src_dir that was used when SConscript() was used. The core code is the base for repository(). However the src_dir was removed as it was broken with the logic to change the directory to the location of the "sconscript". This gets worse with the idea that the src directory has to be under the sconscript. The reality is that it does not. 

Jason

-----Original Message-----
From: Mats Wichmann <mats at wichmann.us> 
Sent: Monday, January 28, 2019 5:06 PM
To: SCons developer list <scons-dev at scons.org>; Jason Kenny <dragon512 at live.com>
Subject: Re: [Scons-dev] proposed change to _SConscript

So at least vaguely confused:

>> are you using Repository to achieve this?

> No,

any yet, the comments at the code snippet suggests strongly Repository is involved:

>                     except OSError:
>                         # There was no local directory, so we should be
>                         # able to chdir to the Repository directory.
>                         # Note that we do this directly,
...




More information about the Scons-dev mailing list