Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions SCons/Tool/lex.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
else:
BINS = ["flex", "lex"]


def lexEmitter(target, source, env):
sourceBase, sourceExt = os.path.splitext(SCons.Util.to_String(source[0]))

Expand All @@ -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):
"""
Expand Down Expand Up @@ -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)
Expand Down
44 changes: 44 additions & 0 deletions test/LEX/lex_headerfile.py
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 2 additions & 0 deletions test/LEX/lex_headerfile/spaced path/SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DefaultEnvironment(tools=[])
SConscript("src/SConscript")
10 changes: 10 additions & 0 deletions test/LEX/lex_headerfile/spaced path/src/SConscript
Original file line number Diff line number Diff line change
@@ -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')
1 change: 1 addition & 0 deletions test/LEX/lex_headerfile/spaced path/src/lexer.l
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%%
1 change: 1 addition & 0 deletions test/LEX/lex_headerfile/spaced path/src/lexer2.l
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%%