I assume you are on some flavor of Linux...
This is the questionable line:
g++ -o lib/mypaintlib_wrap.os -c " " - W a l l " " - W n o - s i g n - c o m p a r e " " - W n o - w r i t e - s t r i n g s -fno-strict-aliasing -fmessage-length=0 -O2 -Wall -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fwrapv -fPIC -D_FORTIFY_SOURCE=2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lsd/lib/python/lib64/python2.6/site-packages/numpy/core/include -I/usr/include/python2.6 lib/mypaintlib_wrap.cpp
Not sure why those g++ options are getting expanded like that (with spaces, with ""), g++ is interpreting them as file names, not compile options. I just tested on my Ubuntu Studio installation, it compiled cleanly:
$ sudo scons prefix=/usr/local install
scons: Reading SConscript files ...
Building for python2.7
swig -o mypaintlib_wrap.cpp -noproxydel -python -c++ mypaintlib.i
python2.7 generate.py
Checked brushsettings.hpp
set umask to 0022 (was 0022)
scons: done reading SConscript files.
scons: Building targets ...
burn_python_version(["mypaint"], ["mypaint.py"])
Chmod("mypaint", 0755)
Install file: "mypaint" as "/usr/local/bin/mypaint"
Chmod("/usr/local/bin/mypaint", 0755)
Chmod("/usr/local/bin", 0755)
g++ -o lib/mypaintlib_wrap.os -c -Wall -Wno-sign-compare -Wno-write-strings -fno-strict-aliasing -g -fwrapv -O2 -Wall -Wstrict-prototypes -Xlinker -export-dynamic -fPIC -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libpng12 -I/usr/lib/pymodules/python2.7/numpy/core/include -I/usr/include/python2.7 lib/mypaintlib_wrap.cpp
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
g++ -o lib/_mypaintlib.so -Wl,-O1 -Wl,-Bsymbolic-functions -shared lib/mypaintlib_wrap.os -L/usr/lib/x86_64-linux-gnu -L/usr/lib/python2.7/config -lglib-2.0 -lpng12 -lpthread -ldl -lutil -lm -lpython2.7
Install file: "lib/_mypaintlib.so" as "/usr/local/lib/mypaint/_mypaintlib.so"
...
What distro are you on? Might be easier to install with your packaging system rather than compiling.