From b2714cbc303a637f31d2629859f732d1b28d9407 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 3 Jan 2013 17:38:28 +0000 Subject: [PATCH] Fix mod_mongo build when no CFLAGS/CXXFLAGS are set in environment os.environ['CFLAGS'] raises a KeyError if no CFLAGS variable is set in the environment. So instead we use os.environ.get('CFLAGS','') which will return the empty string in the event no CFLAGS variable is set. The previous problematic pattern originated from the suggested code here for importing the build environment in SCons: http://www.scons.org/wiki/FrequentlyAskedQuestions#Why_doesn.27t_SCons_find_my_compiler.2BAC8-linker.2BAC8-etc..3F_I_can_execute_it_just_fine_from_the_command_line. FS-4746 --resolve --- src/mod/applications/mod_mongo/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_mongo/Makefile b/src/mod/applications/mod_mongo/Makefile index cdab0466be..9ce16b1171 100644 --- a/src/mod/applications/mod_mongo/Makefile +++ b/src/mod/applications/mod_mongo/Makefile @@ -25,8 +25,8 @@ $(MONGO_CXX_DRIVER_SRC): $(LIBMONGOCLIENT_A): $(MONGO_CXX_DRIVER_SRC) (cd $(MONGO_CXX_DRIVER_SRC) && \ - sed -i SConstruct -e "s/Environment()/Environment(ENV = {'PATH' : os.environ['PATH'],'CFLAGS' : os.environ['CFLAGS'],'CXXFLAGS' : os.environ['CXXFLAGS']})/" && \ - echo "env.Append(PATH=os.environ['PATH'])" >> SConstruct && \ + sed -i SConstruct -e "s|Environment()|Environment(ENV = {'PATH' : os.environ.get('PATH','/bin:/usr/bin'),'CFLAGS' : os.environ.get('CFLAGS',''),'CXXFLAGS' : os.environ.get('CXXFLAGS','')})|" && \ + echo "env.Append(PATH=os.environ.get('PATH','/bin:/usr/bin'))" >> SConstruct && \ scons) $(TOUCH_TARGET)