diff --git a/CHANGES.txt b/CHANGES.txt index 28785e12f8..87766c38d9 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -135,6 +135,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER Note that these are called for every build command run by SCons. It could have considerable performance impact if not used carefully. to connect to the server during start up. + - lex: Fixed an issue with the lex tool where file arguments specified to either "--header-file=" + or "--tables-file=" which included a space in the path to the file would be processed incorrectly - Ninja: added option "--skip-ninja-regen" to enable skipping regeneration of the ninja file if scons can determine the ninja file doesnot need to be regenerated, which will also skip restarting the scons daemon. Note this option is could result in incorrect rebuilds diff --git a/RELEASE.txt b/RELEASE.txt index abecf390d4..fce184f468 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -111,9 +111,9 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY if scons can determine the ninja file doesnot need to be regenerated, which will also skip restarting the scons daemon. Note this option is could result in incorrect rebuilds if scons Glob or scons generated files are used in ninja build target's command lines. + FIXES ----- - - Fix a number of Python ResourceWarnings which are issued when running SCons and/or it's tests with python 3.9 (or higher) - Ninja: Fix issue where Configure files weren't being properly processed when build run @@ -156,6 +156,8 @@ FIXES - The system environment variable names imported for MSVC 7.0 and 6.0 were updated to be consistent with the variables names defined by their respective installers. This fixes an error caused when bypassing MSVC detection by specifying the MSVC 7.0 batch file directly. +- lex: Fixed an issue with the lex tool where file arguments specified to either "--header-file=" + or "--tables-file=" which included a space in the path to the file would be processed incorrectly - Suppress issuing a warning when there are no installed Visual Studio instances for the default tools configuration (issue #2813). When msvc is the default compiler because there are no compilers installed, a build may fail due to the cl.exe command not being recognized. At diff --git a/SCons/Tool/lex.py b/SCons/Tool/lex.py index d8d8de4f54..96f9bcb93c 100644 --- a/SCons/Tool/lex.py +++ b/SCons/Tool/lex.py @@ -46,6 +46,7 @@ else: BINS = ["flex", "lex"] + def lexEmitter(target, source, env): sourceBase, sourceExt = os.path.splitext(SCons.Util.to_String(source[0])) @@ -56,18 +57,19 @@ def lexEmitter(target, source, env): # files generated by flex. # Different options that are used to trigger the creation of extra files. - fileGenOptions = ["--header-file=", "--tables-file="] + file_gen_options = ["--header-file=", "--tables-file="] - lexflags = env.subst("$LEXFLAGS", target=target, source=source) + lexflags = env.subst_list("$LEXFLAGS", target=target, source=source) for option in SCons.Util.CLVar(lexflags): - for fileGenOption in fileGenOptions: + for fileGenOption in file_gen_options: l = len(fileGenOption) if option[:l] == fileGenOption: # A file generating option is present, so add the # file name to the target list. - fileName = option[l:].strip() - target.append(fileName) - return (target, source) + file_name = option[l:].strip() + target.append(file_name) + return target, source + def get_lex_path(env, append_paths=False): """ @@ -128,6 +130,7 @@ def generate(env): env["LEX"] = env.Detect(BINS) env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET" + def exists(env): if sys.platform == 'win32': return get_lex_path(env) diff --git a/test/LEX/lex_headerfile.py b/test/LEX/lex_headerfile.py new file mode 100644 index 0000000000..c2e2e8bfd9 --- /dev/null +++ b/test/LEX/lex_headerfile.py @@ -0,0 +1,44 @@ +#!/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. + +""" +Test the headerfile option for lex tool. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.dir_fixture('lex_headerfile') + +test.run(chdir='spaced path', arguments='.') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/LEX/lex_headerfile/spaced path/SConstruct b/test/LEX/lex_headerfile/spaced path/SConstruct new file mode 100644 index 0000000000..aa4aca0aed --- /dev/null +++ b/test/LEX/lex_headerfile/spaced path/SConstruct @@ -0,0 +1,2 @@ +DefaultEnvironment(tools=[]) +SConscript("src/SConscript") \ No newline at end of file diff --git a/test/LEX/lex_headerfile/spaced path/src/SConscript b/test/LEX/lex_headerfile/spaced path/src/SConscript new file mode 100644 index 0000000000..a3f4bfdeca --- /dev/null +++ b/test/LEX/lex_headerfile/spaced path/src/SConscript @@ -0,0 +1,10 @@ +env = Environment(tools=['lex']) + +def make_header_path(env, target, source, for_signature): + return target[1] + +env.Replace(LEX_HEADER_FILE_GEN=make_header_path) +env.Append(LEXFLAGS=['--header-file=$LEX_HEADER_FILE_GEN']) + +env.CFile(target=['#gen_src/lexer.c', '#gen_src/lexer.l.h'], source='lexer.l') +env.CFile(target=['#gen_src/lexer2.c', '#gen_src/lexer2.l.h'], source='lexer2.l') \ No newline at end of file diff --git a/test/LEX/lex_headerfile/spaced path/src/lexer.l b/test/LEX/lex_headerfile/spaced path/src/lexer.l new file mode 100644 index 0000000000..66b82a4b2c --- /dev/null +++ b/test/LEX/lex_headerfile/spaced path/src/lexer.l @@ -0,0 +1 @@ +%% \ No newline at end of file diff --git a/test/LEX/lex_headerfile/spaced path/src/lexer2.l b/test/LEX/lex_headerfile/spaced path/src/lexer2.l new file mode 100644 index 0000000000..66b82a4b2c --- /dev/null +++ b/test/LEX/lex_headerfile/spaced path/src/lexer2.l @@ -0,0 +1 @@ +%% \ No newline at end of file