Skip to content

Commit 2e817ae

Browse files
committed
Minor type and doc tweaks [skip appveyor]
These are changes harvested from abandoned PR SCons#4671 so they're not lost. These changes were not the large surgery to doc/man/scons.xml about builders. The changes consist of a few formatting changes, moving one chunk of text i nthe SharedObject doc down ito its own paragraph and consistently using single_source as a boolean Signed-off-by: Mats Wichmann <mats@linux.com>
1 parent c005b06 commit 2e817ae

File tree

5 files changed

+34
-29
lines changed

5 files changed

+34
-29
lines changed

SCons/BuilderTests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,8 @@ def func(target, source, env) -> None:
714714
infiles.append(test.workpath('%d.in' % i))
715715
outfiles.append(test.workpath('%d.out' % i))
716716
test.write(infiles[-1], "\n")
717-
builder = SCons.Builder.Builder(action=SCons.Action.Action(func,None),
718-
single_source = 1, suffix='.out')
717+
builder = SCons.Builder.Builder(action=SCons.Action.Action(func, None),
718+
single_source=True, suffix='.out')
719719
env['CNT'] = [0]
720720
tgt = builder(env, target=outfiles[0], source=infiles[0])[0]
721721
s = str(tgt)

SCons/EnvironmentTests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ def TestEnvironment(self, *args, **kw):
156156
if key not in kw:
157157
kw[key] = value
158158
if 'BUILDERS' not in kw:
159-
static_obj = SCons.Builder.Builder(action = {},
160-
emitter = {},
161-
suffix = '.o',
162-
single_source = 1)
159+
static_obj = SCons.Builder.Builder(action={},
160+
emitter={},
161+
suffix='.o',
162+
single_source=True)
163163
kw['BUILDERS'] = {'Object' : static_obj}
164164
static_obj.add_action('.cpp', 'fake action')
165165

SCons/Node/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def get_contents_dir(node):
215215
contents.append('%s %s\n' % (n.get_csig(), n.name))
216216
return ''.join(contents)
217217

218-
def get_contents_file(node):
218+
def get_contents_file(node) -> bytes:
219219
if not node.rexists():
220220
return b''
221221
fname = node.rfile().get_abspath()

SCons/Tool/Tool.xml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -281,38 +281,41 @@ when it is done linking it.
281281
Builds an object file intended for
282282
inclusion in a shared library.
283283
Source files must have one of the same set of extensions
284-
specified above for the
285-
&b-StaticObject;
284+
specified for the
285+
&b-link-StaticObject;
286286
builder method.
287-
On some platforms building a shared object requires additional
288-
compiler option
289-
(e.g. <option>-fPIC</option> for <command>gcc</command>)
290-
in addition to those needed to build a
291-
normal (static) object, but on some platforms there is no difference between a
292-
shared object and a normal (static) one. When there is a difference, SCons
293-
will only allow shared objects to be linked into a shared library, and will
294-
use a different suffix for shared objects. On platforms where there is no
295-
difference, SCons will allow both normal (static)
296-
and shared objects to be linked into a
297-
shared library, and will use the same suffix for shared and normal
298-
(static) objects.
299287
The target object file prefix,
300288
specified by the &cv-link-SHOBJPREFIX; &consvar;
301289
(by default, the same as &cv-link-OBJPREFIX;),
302290
and suffix,
303291
specified by the &cv-link-SHOBJSUFFIX; &consvar;,
304292
are automatically added to the target if not already present.
293+
&b-SharedObject; is a single-source builder.
305294
Examples:
306295
</para>
307296

308297
<example_commands>
309298
env.SharedObject(target='ddd', source='ddd.c')
310299
env.SharedObject(target='eee.o', source='eee.cpp')
311300
env.SharedObject(target='fff.obj', source='fff.for')
301+
env.SharedObject(source=Glob('*.c'))
312302
</example_commands>
313303

314304
<para>
315-
Note that the source files will be scanned
305+
On some platforms building a shared object requires additional
306+
compiler option(s)
307+
(e.g. <option>-fPIC</option> for <command>gcc</command>)
308+
in addition to those needed to build a
309+
normal (static) object.
310+
If shared and static objects differ,
311+
&SCons; will allow only shared objects
312+
to be linked into a shared library,
313+
and will use a different suffix for shared objects
314+
to help indicate and track the difference.
315+
</para>
316+
317+
<para>
318+
Source files will be scanned
316319
according to the suffix mappings in the
317320
<classname>SourceFileScanner</classname>
318321
object.
@@ -364,10 +367,10 @@ will raise an error if there is any mismatch.
364367
<para>
365368
Builds a static object file
366369
from one or more C, C++, D, or Fortran source files.
367-
Source files must have one of the following extensions:
370+
The file extension mapping is shown in the table:
368371
</para>
369372

370-
<example_commands>
373+
<literallayout><literal>
371374
.asm assembly language file
372375
.ASM assembly language file
373376
.c C file
@@ -396,28 +399,30 @@ Source files must have one of the following extensions:
396399
POSIX: assembly language file + C pre-processor
397400
.spp assembly language file + C pre-processor
398401
.SPP assembly language file + C pre-processor
399-
</example_commands>
402+
</literal></literallayout>
400403

401404
<para>
402405
The target object file prefix,
403406
specified by the &cv-link-OBJPREFIX; &consvar;
404-
(nothing by default),
407+
(empty string by default),
405408
and suffix,
406409
specified by the &cv-link-OBJSUFFIX; &consvar;
407410
(<filename>.obj</filename> on Windows systems,
408411
<filename>.o</filename> on POSIX systems),
409412
are automatically added to the target if not already present.
413+
&b-StaticObject; is a single-source builder.
410414
Examples:
411415
</para>
412416

413417
<example_commands>
414418
env.StaticObject(target='aaa', source='aaa.c')
415419
env.StaticObject(target='bbb.o', source='bbb.c++')
416420
env.StaticObject(target='ccc.obj', source='ccc.f')
421+
env.StaticObject(source=Glob('*.c'))
417422
</example_commands>
418423

419424
<para>
420-
Note that the source files will be scanned
425+
Source files will be scanned
421426
according to the suffix mappings in the
422427
<classname>SourceFileScanner</classname>
423428
object.

SCons/Tool/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def createObjBuilders(env):
408408
suffix='$OBJSUFFIX',
409409
src_builder=['CFile', 'CXXFile'],
410410
source_scanner=SourceFileScanner,
411-
single_source=1)
411+
single_source=True)
412412
env['BUILDERS']['StaticObject'] = static_obj
413413
env['BUILDERS']['Object'] = static_obj
414414

@@ -421,7 +421,7 @@ def createObjBuilders(env):
421421
suffix='$SHOBJSUFFIX',
422422
src_builder=['CFile', 'CXXFile'],
423423
source_scanner=SourceFileScanner,
424-
single_source=1)
424+
single_source=True)
425425
env['BUILDERS']['SharedObject'] = shared_obj
426426

427427
return (static_obj, shared_obj)

0 commit comments

Comments
 (0)