Skip to content

Commit 8fea6a2

Browse files
authored
Merge pull request #4791 from mwichmann/doc/top-rel
Improve details on top-relative paths in manpage
2 parents 24e4fd4 + 478868e commit 8fea6a2

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
2020

2121
From Mats Wichmann:
2222
- Introduce some unit tests for the file locking utility routines
23+
- More clarifications in manpage Builder Methods section.
2324
- Reduce unneeded computation of overrides. The Mkdir builder used an
2425
unknown argument ('explain') on creation, causing it to be considered
2526
an override. Also, if override dict is empty, don't even call the

RELEASE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ DOCUMENTATION
6060

6161
- Fix SCons Docbook schema to work with lxml > 5
6262

63+
- More clarifications in manpage Builder Methods section.
64+
6365

6466
DEVELOPMENT
6567
-----------

doc/man/scons.xml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2981,12 +2981,23 @@ env.Program('bar', source='bar.c foo.c'.split())
29812981

29822982
<note>
29832983
<para>
2984-
Top-relative paths <emphasis role="bold">only</emphasis> work
2984+
Top-relative paths only work
29852985
where &SCons; will interpret the path (see examples).
2986-
To be used in other contexts the string must first be converted
2987-
to a relative or absolute path.
2986+
The string must first be converted
2987+
to a relative or absolute path
2988+
to be used in other contexts
2989+
(such as pure &Python; code that does not
2990+
involve an &SCons; API call),
29882991
A suitable string can be extracted from the Node
2989-
created from the top-relative path.
2992+
created from a top-relative path.
2993+
Additionally, some paths are handled by &SCons; but
2994+
are not directly build participants,
2995+
so are not evaluated for the <literal>#</literal>
2996+
since no Nodes are created.
2997+
You can explcitly create a &f-link-File; or &f-link-Dir;
2998+
node to force evaluation,
2999+
such as when specifying a path to the derived-file cache:
3000+
<literal>CacheDir(Dir('#cache'))</literal>.
29903001
</para>
29913002
</note>
29923003

@@ -3012,10 +3023,13 @@ env.Program('#/bar', 'bar.c')
30123023
# SConstruct directory) from "subdir/foo.c":
30133024
env.Program('#other/foo', 'foo.c')
30143025

3015-
# This will not work, only SCons interfaces understand '#',
3016-
# os.path.exists is pure Python:
3026+
# os.path.exists() is pure Python, so this fails:
30173027
if os.path.exists('#inc/foo.h'):
30183028
env.Append(CPPPATH='#inc')
3029+
3030+
# create a Node to make it work:
3031+
if os.path.exists(File('#inc/foo.h')):
3032+
env.Append(CPPPATH='#inc')
30193033
</programlisting>
30203034

30213035
<para>

0 commit comments

Comments
 (0)