build: do not look for unneeded libraries

Also a few cleanups in wscripts

Change-Id: Ia5b470d4adcf5697d8c0a31ba1204e5355951308
diff --git a/tests/wscript b/tests/wscript
index 750f82d..32c89f4 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -2,14 +2,14 @@
 top = '..'
 
 def build(bld):
-    if not bld.env['WITH_TESTS']:
+    if not bld.env.WITH_TESTS:
         return
 
     tmp_path = 'TMP_TESTS_PATH="%s"' % bld.bldnode.make_node('tmp-files')
     bld.program(
         target='../unit-tests',
         name='unit-tests',
-        source=bld.path.ant_glob(['*.cpp'] + ['%s/**/*.cpp' % tool for tool in bld.env['BUILD_TOOLS']]),
-        use=['core-objects'] + ['%s-objects' % tool for tool in bld.env['BUILD_TOOLS']],
-        install_path=None,
-        defines=[tmp_path])
+        source=bld.path.ant_glob(['*.cpp'] + ['%s/**/*.cpp' % tool for tool in bld.env.BUILD_TOOLS]),
+        use=['core-objects'] + ['%s-objects' % tool for tool in bld.env.BUILD_TOOLS],
+        defines=[tmp_path],
+        install_path=None)