Skip to content
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Switch remaining "original style" docstring parameter listings to
Google style.

From Keith F Prussing:
- Fix multiple extension stripping for BibTeX and Biber processing


RELEASE 4.10.1 - Sun, 16 Nov 2025 10:51:57 -0700

Expand Down
1 change: 1 addition & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ FIXES
-----

- List fixes of outright bugs
- Fix multiple extension stripping for BibTeX and Biber processing

- Fix --debug=includes for case of multiple source files.

Expand Down
10 changes: 6 additions & 4 deletions SCons/Tool/tex.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,9 @@ def check_content_hash(filenode, suffix) -> bool:
if 'bibdata' in content:
if Verbose:
print("Need to run bibtex on ",auxfilename)
bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0])
result = BibTeXAction(bibfile, bibfile, env)
auxfile = env.fs.File(target_aux)
bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0] + ".bib")
result = BibTeXAction(bibfile, auxfile, env)
if result != 0:
check_file_error_message(env['BIBTEX'], 'blg')
check_content_hash(suffix_nodes[".bbl"], ".bbl")
Expand All @@ -363,8 +364,9 @@ def check_content_hash(filenode, suffix) -> bool:
if 'bibdata' in content:
if Verbose:
print("Need to run biber on ",bcffilename)
bibfile = env.fs.File(SCons.Util.splitext(target_bcf)[0])
result = BiberAction(bibfile, bibfile, env)
auxfile = env.fs.File(target_aux)
bibfile = env.fs.File(SCons.Util.splitext(target_aux)[0] + ".bbl")
result = BiberAction(bibfile, auxfile, env)
if result != 0:
check_file_error_message(env['BIBER'], 'blg')
check_content_hash(suffix_nodes[".bbl"], ".bbl")
Expand Down
80 changes: 80 additions & 0 deletions test/TEX/bibtex-extra-extension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env python
#
# MIT License
#
# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

"""
Verify that running LaTeX with a file named main.extra.tex pulls the
right bibliography file.
"""

import TestSCons

test = TestSCons.TestSCons()

pdflatex = test.where_is('pdflatex')

if not pdflatex:
test.skip_test("Could not find 'pdflatex'; skipping test(s).\n")

mains = ["main.tex", "main.extra.tex"]

test.write(["SConstruct"], f"""\
import os
env = Environment(tools=['pdftex', 'tex'])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though it has nothing to do with correctness, we often sneak in a line before the initial env creation like

DefaultEnvironment(tools=[])

This is purely a hack for performance running the testsuite, and isn't something people should actually have to do. No downvote if not changed.

env.PDF({mains})
""")

body_content = r"""\documentclass{article}
\begin{document}
SCons \cite{scons}!
\bibliography{references}
\bibliographystyle{plain}
\end{document}
"""

for _ in mains:
test.write(_, body_content)

test.write("references.bib", r"""
@misc{scons,
title = {SCons},
url = {https://scons.org},
language = {en-US},
urldate = {2025-08-15},
author = {{SCons} {Foundation}},
year = {2025},
}
""")

test.run()

pdfs = [test.normalize_pdf(test.read(_[:-3] + "pdf")) for _ in mains]
test.fail_test(pdfs[0] != pdfs[1])
test.pass_test()

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4: