From 6f708d0ca8b7f61a1d7ba98a945e32b25417952d Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Fri, 8 Oct 2004 11:11:50 +0000 Subject: ParseConfig and -Ifilename. --- src/CHANGES.txt | 3 +++ src/engine/SCons/Environment.py | 15 ++++++++++++--- src/engine/SCons/EnvironmentTests.py | 6 +++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 0b647c9..d8ce645 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -91,6 +91,9 @@ RELEASE 0.97 - XXX - Add a missing newline to the end of the --debug=explain "unknown reasons" message. + - Enhance ParseConfig() to work properly for spaces in between the -I, + -L and -l options and their arguments. + From Clive Levinson: - Make ParseConfig() recognize and add -mno-cygwin to $LINKFLAGS and diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 8f76d55..caa3b85 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -763,11 +763,20 @@ class Base: elif arg[0] != '-': dict['LIBS'].append(fs.File(arg)) elif arg[:2] == '-L': - dict['LIBPATH'].append(arg[2:]) + if arg[2:]: + dict['LIBPATH'].append(arg[2:]) + else: + append_next_arg_to = 'LIBPATH' elif arg[:2] == '-l': - dict['LIBS'].append(arg[2:]) + if arg[2:]: + dict['LIBS'].append(arg[2:]) + else: + append_next_arg_to = 'LIBS' elif arg[:2] == '-I': - dict['CPPPATH'].append(arg[2:]) + if arg[2:]: + dict['CPPPATH'].append(arg[2:]) + else: + append_next_arg_to = 'CPPPATH' elif arg[:4] == '-Wa,': dict['ASFLAGS'].append(arg) elif arg[:4] == '-Wl,': diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index b2f3536..27e7e8b 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1349,8 +1349,8 @@ def exists(env): save_command.append(command) class fake_file: def read(self): - return "-I/usr/include/fum -Ibar -X\n" + \ - "-L/usr/fax -Lfoo -lxxx " + \ + return "-I/usr/include/fum -I bar -X\n" + \ + "-L/usr/fax -L foo -lxxx -l yyy " + \ "-Wa,-as -Wl,-link -Wp,-cpp abc " + \ "-pthread -framework Carbon " + \ "-mno-cygwin -mwindows" @@ -1363,7 +1363,7 @@ def exists(env): assert env['CPPPATH'] == ['string', '/usr/include/fum', 'bar'], env['CPPPATH'] assert env['CPPFLAGS'] == ['', '-Wp,-cpp'], env['CPPFLAGS'] assert env['LIBPATH'] == ['list', '/usr/fax', 'foo'], env['LIBPATH'] - assert env['LIBS'] == ['xxx', env.File('abc')], env['LIBS'] + assert env['LIBS'] == ['xxx', 'yyy', env.File('abc')], env['LIBS'] assert env['LINKFLAGS'] == ['', '-Wl,-link', '-pthread', '-framework', 'Carbon', '-mno-cygwin', '-mwindows'], env['LINKFLAGS'] assert env['CCFLAGS'] == ['', '-X', '-pthread', '-mno-cygwin'], env['CCFLAGS'] finally: -- cgit v0.12