Issue 2228: Add os.devnull to the SCons.compat layer.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 28 Oct 2008 01:00:25 +0000 (01:00 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 28 Oct 2008 01:00:25 +0000 (01:00 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@3741 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/compat/__init__.py

index 9a58dc674c5debdaedfde73c0f0ad282543a914c..cc48ce3ddca72ba324eace51a9f851dffa0206b1 100644 (file)
@@ -155,6 +155,19 @@ except ImportError:
     # Pre-2.3 Python has no optparse module.
     import_as('_scons_optparse', 'optparse')
 
+import os
+try:
+    os.devnull
+except AttributeError:
+    # Pre-2.4 Python has no os.devnull attribute
+    import sys
+    _names = sys.builtin_module_names
+    if 'posix' in _names:
+        os.devnull = '/dev/null'
+    elif 'nt' in _names:
+        os.devnull = 'nul'
+    os.path.devnull = os.devnull
+
 import shlex
 try:
     shlex.split