diff --git a/CHANGES.txt b/CHANGES.txt index d96714030..0229fb906 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -19,6 +19,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From William Deegan: - Fix SCons Docbook schema to work with lxml > 5 + 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 diff --git a/RELEASE.txt b/RELEASE.txt index 8141c8c57..bdee35879 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -33,6 +33,7 @@ FIXES ----- - List fixes of outright bugs +- Fix multiple extension stripping for BibTeX and Biber processing IMPROVEMENTS ------------ diff --git a/SCons/Tool/tex.py b/SCons/Tool/tex.py index 6d366334a..952c8f6fc 100644 --- a/SCons/Tool/tex.py +++ b/SCons/Tool/tex.py @@ -340,8 +340,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") @@ -364,8 +365,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") diff --git a/test/TEX/bibtex-extra-extension.py b/test/TEX/bibtex-extra-extension.py new file mode 100644 index 000000000..d2b1231b2 --- /dev/null +++ b/test/TEX/bibtex-extra-extension.py @@ -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']) +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: