Skip to content

Commit 0ebf885

Browse files
committed
Extend pdf-skipping to man and user builds.
An earlier change extended SKIP_DOC as a CLI argument at the top level to allow granularity - can specify pdf and/or api to skip those. Skipping the pdf build didn't entirely work, as the build re-invokes SCons which is then a fresh context. That information is now passed on the command line to those two builds, and if invokved directly (as Debian packaging does), SKIP_PDF=1 can be added on the command line. Signed-off-by: Mats Wichmann <[email protected]>
1 parent 6364bcd commit 0ebf885

File tree

6 files changed

+57
-44
lines changed

6 files changed

+57
-44
lines changed

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
3232
ones in parent NodeInfoBase and can just be inherited.
3333
- Update manpage for Tools, and for TOOL, which also gets a minor
3434
tweak for how it's handled (should be more accurate in a few situations).
35+
- Documentation build now properly passes through skipping the PDF
36+
(and EPUB) builds of manpage and user guide; this can also be done
37+
manually if directly calling doc/man/SConstruct and doc/user/SConstruct
38+
by adding SKIP_PDF=1. This should help with distro packaging of SCons,
39+
which now does not need "fop" and other tools to be set up in order to
40+
build pdf versions which are then ignored.
3541

3642

3743
RELEASE 4.7.0 - Sun, 17 Mar 2024 17:22:20 -0700

RELEASE.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ DOCUMENTATION
6969
DEVELOPMENT
7070
-----------
7171

72-
- List visible changes in the way SCons is developed
72+
- Documentation build now properly passes through skipping the PDF
73+
(and EPUB) builds of manpage and user guide; this can also be done
74+
manually if directly calling doc/man/SConstruct and doc/user/SConstruct
75+
by adding SKIP_PDF=1. This should help with distro packaging of SCons,
76+
which now does not need "fop" and other tools to be set up in order to
77+
build pdf versions which are then ignored.
78+
7379

7480
Thanks to the following contributors listed below for their contributions to this release.
7581
==========================================================================================

doc/SConscript

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,13 @@ else:
490490
sctargets.append(os.path.join(scdir, f'scons-{man}.pdf'))
491491
sctargets.append(os.path.join(scdir, f'scons-{man}.html'))
492492

493+
# pass on the information to skip PDF/EPUB when calling man/guide SConstruct
494+
skip_str = "SKIP_PDF=1" if skip_pdf_build else ""
493495
nodes.extend(
494496
env.Command(
495497
target=sctargets,
496498
source=buildsuite + depends,
497-
action="cd %s && $PYTHON ${SCONS_PY.abspath}%s" % (scdir, cleanopt),
499+
action="cd %s && $PYTHON ${SCONS_PY.abspath}%s %s" % (scdir, cleanopt, skip_str),
498500
)
499501
)
500502

@@ -545,7 +547,7 @@ else:
545547
tar_deps.append(pdf)
546548
tar_list.append(pdf)
547549

548-
if 'epub' in targets and gs:
550+
if 'epub' in targets and not skip_pdf_build and gs:
549551
env.InstallAs(
550552
target=env.File(epub),
551553
source=env.File(os.path.join(build, doc, f'scons-{doc}.epub')),

doc/man/SConstruct

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,40 @@
1-
#
2-
# SConstruct file for building SCons documentation.
3-
#
1+
# SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
2+
# SPDX-License-Identifier: MIT
43

5-
#
6-
# __COPYRIGHT__
7-
#
8-
# Permission is hereby granted, free of charge, to any person obtaining
9-
# a copy of this software and associated documentation files (the
10-
# "Software"), to deal in the Software without restriction, including
11-
# without limitation the rights to use, copy, modify, merge, publish,
12-
# distribute, sublicense, and/or sell copies of the Software, and to
13-
# permit persons to whom the Software is furnished to do so, subject to
14-
# the following conditions:
15-
#
16-
# The above copyright notice and this permission notice shall be included
17-
# in all copies or substantial portions of the Software.
18-
#
19-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
20-
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
21-
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4+
"""
5+
SConstruct file for building SCons manpages.
6+
7+
This is usually invoked as a separate build by the top-level SCons build.
8+
9+
If invoked directly, can add SKIP_PDF=1 to avoid pdf and epub generation.
10+
"""
2611

2712
import os
2813

29-
env = Environment(ENV={'PATH' : os.environ['PATH']},
30-
tools=['docbook','gs','zip'],
31-
toolpath=['../../SCons/Tool'],
32-
DOCBOOK_DEFAULT_XSL_HTML='html.xsl',
33-
DOCBOOK_DEFAULT_XSL_PDF='pdf.xsl')
14+
env = Environment(
15+
ENV={'PATH': os.environ['PATH']},
16+
tools=['docbook', 'gs', 'zip'],
17+
toolpath=['../../SCons/Tool'],
18+
DOCBOOK_DEFAULT_XSL_HTML='html.xsl',
19+
DOCBOOK_DEFAULT_XSL_PDF='pdf.xsl',
20+
)
3421

22+
skip_pdf = ARGUMENTS.get('SKIP_PDF', False)
3523
has_pdf = False
36-
if (env.WhereIs('fop') or
37-
env.WhereIs('xep')):
24+
if not skip_pdf and any((env.WhereIs('fop'), env.WhereIs('xep'))):
3825
has_pdf = True
3926

4027
# Helper function, combining all the steps for a single target
4128
def createManPages(env, target):
4229
env.DocbookXInclude('%s_xi.xml' % target, '%s.xml' % target)
43-
env.DocbookXslt('%s_db.xml' % target, '%s_xi.xml' % target,
44-
xsl='../xslt/to_docbook.xslt')
45-
env.DocbookHtml('scons-%s.html' % target,'%s_db.xml' % target)
30+
env.DocbookXslt(
31+
'%s_db.xml' % target, '%s_xi.xml' % target, xsl='../xslt/to_docbook.xslt'
32+
)
33+
env.DocbookHtml('scons-%s.html' % target, '%s_db.xml' % target)
4634
env.DocbookMan('%s.1' % target, '%s_db.xml' % target)
4735
if has_pdf:
48-
env.DocbookPdf('scons-%s.pdf' % target,'%s_db.xml' % target)
36+
env.DocbookPdf('scons-%s.pdf' % target, '%s_db.xml' % target)
37+
4938

5039
#
5140
# Create MAN pages
@@ -62,7 +51,10 @@ if env.WhereIs('gs'):
6251
# Create the EPUB format
6352
#
6453
if has_gs and has_pdf:
65-
jpg = env.Gs('OEBPS/cover.jpg','scons-scons.pdf',
66-
GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -dJPEGQ=100 -r72x72 -q')
54+
jpg = env.Gs(
55+
'OEBPS/cover.jpg',
56+
'scons-scons.pdf',
57+
GSFLAGS='-dNOPAUSE -dBATCH -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -dJPEGQ=100 -r72x72 -q',
58+
)
6759
epub = env.DocbookEpub('scons-man.epub', 'scons_db.xml', xsl='epub.xsl')
6860
env.Depends(epub, jpg)

doc/user/SConstruct

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
22
# SPDX-License-Identifier: MIT
3-
#
4-
# SConstruct file for building SCons documentation.
5-
#
3+
4+
"""
5+
SConstruct file for building SCons User Guide..
6+
7+
This is usually invoked as a separate build by the top-level SCons build.
8+
9+
If invoked directly, can add SKIP_PDF=1 to avoid pdf and epub generation.
10+
"""
611

712
import os
813

@@ -16,8 +21,9 @@ env = Environment(
1621
DOCBOOK_DEFAULT_XSL_PDF='pdf.xsl',
1722
)
1823

24+
skip_pdf = ARGUMENTS.get('SKIP_PDF', False)
1925
has_pdf = False
20-
if env.WhereIs('fop') or env.WhereIs('xep'):
26+
if not skip_pdf and any((env.WhereIs('fop'), env.WhereIs('xep'))):
2127
has_pdf = True
2228

2329
#

site_scons/BuildCommandLine.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def init_command_line_variables(self):
7979
"SKIP_DOC=",
8080
"Skip building documents. The value can be 'pdf', 'api', "
8181
"''all' or 'none'. A comma-separated list is also allowed. "
82+
"Do not set this for an official release build. "
8283
"The default is 'none' (build all docs)"
8384
),
8485
]

0 commit comments

Comments
 (0)