Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scanners getting added even when tool is not present, LaTeX scanner error when subst exceptions are ignored #4511

Open
DeeeeLAN opened this issue Apr 11, 2024 · 0 comments
Labels

Comments

@DeeeeLAN
Copy link

DeeeeLAN commented Apr 11, 2024

Describe the bug

At the top of SCons/Tool/__init__.py, five scanners are configured with default file extensions, with no regard for their respective backend program's presence.

CScanner = SCons.Scanner.C.CScanner()
DScanner = SCons.Scanner.D.DScanner()
JavaScanner = SCons.Scanner.Java.JavaScanner()
LaTeXScanner = SCons.Scanner.LaTeX.LaTeXScanner()
PDFLaTeXScanner = SCons.Scanner.LaTeX.PDFLaTeXScanner()
ProgramScanner = SCons.Scanner.Prog.ProgramScanner()
SourceFileScanner = SCons.Scanner.ScannerBase({}, name='SourceFileScanner')
SWIGScanner = SCons.Scanner.SWIG.SWIGScanner()

CSuffixes = [".c", ".C", ".cxx", ".cpp", ".c++", ".cc",
             ".h", ".H", ".hxx", ".hpp", ".hh",
             ".F", ".fpp", ".FPP",
             ".m", ".mm",
             ".S", ".spp", ".SPP", ".sx"]

DSuffixes = ['.d']

IDLSuffixes = [".idl", ".IDL"]

LaTeXSuffixes = [".tex", ".ltx", ".latex"]

SWIGSuffixes = ['.i']

for suffix in CSuffixes:
    SourceFileScanner.add_scanner(suffix, CScanner)

for suffix in DSuffixes:
    SourceFileScanner.add_scanner(suffix, DScanner)

for suffix in SWIGSuffixes:
    SourceFileScanner.add_scanner(suffix, SWIGScanner)

# FIXME: what should be done here? Two scanners scan the same extensions,
# but look for different files, e.g., "picture.eps" vs. "picture.pdf".
# The builders for DVI and PDF explicitly reference their scanners
# I think that means this is not needed???
for suffix in LaTeXSuffixes:
    SourceFileScanner.add_scanner(suffix, LaTeXScanner)
    SourceFileScanner.add_scanner(suffix, PDFLaTeXScanner)

For at least the LaTeXScanner, this can lead to an error if AllowSubstExceptions() has been set to disallow undefined env variables, because LaTeXScanner is looking for a $LATEXSUFFIXES variable, which gets a default definition from the LaTeX tool.

Required information

env = Environment(tools=[])
AllowSubstExceptions()
env.Command('file2.tex', 'file1.tex', 'cp $SOURCE $TARGET')
  • How you invoke scons
    • scons
@mwichmann mwichmann changed the title Scanners getting added even when tool is not present, LaTeXScanner error when AllowSubstExceptions() defined Scanners getting added even when tool is not present, LaTeX scanner error when subst exceptions are ignored Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants