From 826f1a8f5f3f8796ae857d0665242779e91b88c9 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Mon, 25 Aug 2008 15:21:20 +0000 Subject: [PATCH] Issue 1982: document GetLaunchDir() in the User's Guide. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3306 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- 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 b924a249..767b40ce 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 21bb0bb7..cb969e71 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 54b021a0..c5f29b68 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 2c8bd267..292c7411 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, -- 2.26.2