From eb705ea31fd0a082f97b3ee7fd07f04271ea2641 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Mon, 25 Aug 2008 15:21:20 +0000 Subject: Issue 1982: document GetLaunchDir() in the User's Guide. --- doc/scons.mod | 1 + doc/user/misc.in | 46 ++++++++++++++++++++++++++++++++++++++++++++++ doc/user/misc.xml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/CHANGES.txt | 4 ++++ 4 files changed, 97 insertions(+) diff --git a/doc/scons.mod b/doc/scons.mod index b924a24..767b40c 100644 --- a/doc/scons.mod +++ b/doc/scons.mod @@ -191,6 +191,7 @@ Flatten"> GenerateHelpText"> GetBuildFailures"> +GetLaunchDir"> GetOption"> Glob"> Help"> diff --git a/doc/user/misc.in b/doc/user/misc.in index 21bb0bb..cb969e7 100644 --- a/doc/user/misc.in +++ b/doc/user/misc.in @@ -373,3 +373,49 @@ + +
+ Finding the Invocation Directory: the &GetLaunchDir; Function + + + + If you need to find the directory from + which the user invoked the &scons; command, + you can use the &GetLaunchDir; function: + + + + + env = Environment( + LAUNCHDIR = GetLaunchDir(), + ) + env.Command('directory_build_info', + '$LAUNCHDIR/build_info' + Copy('$TARGET', '$SOURCE')) + + + + + Because &SCons; is usually invoked from the top-level + directory in which the &SConstruct; file lives, + the Python os.getcwd() + is often equivalent. + However, the &SCons; + -u, + -U + and + -D + command-line options, + when invoked from a subdirectory, + will cause &SCons; to change to the directory + in which the &SConstruct; file is found. + When those options are used, + &GetLaunchDir; will still return the path to the + user's invoking subdirectory, + allowing the &SConscript; configuration + to still get at configuration (or other) files + from the originating directory. + + + +
diff --git a/doc/user/misc.xml b/doc/user/misc.xml index 54b021a..c5f29b6 100644 --- a/doc/user/misc.xml +++ b/doc/user/misc.xml @@ -353,3 +353,49 @@ + +
+ Finding the Invocation Directory: the &GetLaunchDir; Function + + + + If you need to find the directory from + which the user invoked the &scons; command, + you can use the &GetLaunchDir; function: + + + + + env = Environment( + LAUNCHDIR = GetLaunchDir(), + ) + env.Command('directory_build_info', + '$LAUNCHDIR/build_info' + Copy('$TARGET', '$SOURCE')) + + + + + Because &SCons; is usually invoked from the top-level + directory in which the &SConstruct; file lives, + the Python os.getcwd() + is often equivalent. + However, the &SCons; + -u, + -U + and + -D + command-line options, + when invoked from a subdirectory, + will cause &SCons; to change to the directory + in which the &SConstruct; file is found. + When those options are used, + &GetLaunchDir; will still return the path to the + user's invoking subdirectory, + allowing the &SConscript; configuration + to still get at configuration (or other) files + from the originating directory. + + + +
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 2c8bd26..292c741 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -20,6 +20,10 @@ RELEASE 1.0.0 - XXX - Document the ParseDepends() function in the User's Guide. + From Steven Knight: + + - Document the GetLaunchDir() function in the User's Guide. + From Greg Noel: - Handle yacc/bison on newer Mac OS X versions creating file.hpp, -- cgit v0.12