[Scons-dev] proposed change to _SConscript

Jason Kenny dragon512 at live.com
Mon Jan 28 14:01:10 EST 2019


Hi,

I would like to make a proposal to for a small change to _SConscript function.

The change is related to code around line 260. ie this section of code:

try:
                        fs.chdir(ldir, change_os_dir=sconscript_chdir)
                    except OSError:
                        # There was no local directory, so we should be
                        # able to chdir to the Repository directory.
                        # Note that we do this directly, not through
                        # fs.chdir(), because we still need to
                        # interpret the stuff within the SConscript file
                        # relative to where we are logically.
                        fs.chdir(ldir, change_os_dir=0)
                        os.chdir(actual.dir.get_abspath())


I would like to change the os.chdir(actual.dir.get_abspath()) to os.chdir(ldir.srcnode().abspath)

I believe this code is more correct and solve an issue I would like to correct when calling scons on "out of  source" builds.

What this changes as documented, should be nothing. What it changes/fixes is use of the src_dir keyword in the SConscript() call ( which was documented a long time ago).

What this fixes for me is the ability define a build file that is not in a source tree, as if it was in the source tree. In the case Parts I can define a Parts that would checkout or used some code checked out via another means as if the build file was part of the source tree. The value of this is:

1) may not have the ability to add new builds files to an existing project
2) may want to show how a new build system ( as Scons) would add value to an existing setup, without having to get build files checked in.
3) want to build an external project as if the build file was part of the project.
4) other logic related to the above...

This is basically like an CMake external project for me in Parts as I can tell Parts to checkout some code and build it via having a Part file that can build it directly or via having it call the native build system via Command() or some custom builder.

This line change would allow for build file to pretend that it exists in the source location. It would also allow me to define three basic concepts in Parts:

1) build/Variant directory ( where we do the build actions)
2) build file/part_dir directory ( ie the directory in which the build file exists)
3) Source/src_dir directory ( ie where the source exists)

most of this time the src_dir==part_dir except of out of source cases.

I wanted to ask about this to make sure there is nothing I might be missing that would cause concerns

If this is fine I would like to make a patch for this for Scons ( vs me monkey patching it in Parts)

Jason

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20190128/21f99893/attachment.html>


More information about the Scons-dev mailing list