summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2008-10-28 01:00:25 (GMT)
committerSteven Knight <knight@baldmt.com>2008-10-28 01:00:25 (GMT)
commit7f022014954882e106d244f98ae0205108fc6aa5 (patch)
tree45a7e1f815967273c386bb6e990ebb5d75d1381e
parentbf9f8ce8a78ebf9d6153b4660988d59def873a83 (diff)
downloadSCons-7f022014954882e106d244f98ae0205108fc6aa5.zip
SCons-7f022014954882e106d244f98ae0205108fc6aa5.tar.gz
SCons-7f022014954882e106d244f98ae0205108fc6aa5.tar.bz2
Issue 2228: Add os.devnull to the SCons.compat layer.
-rw-r--r--src/engine/SCons/compat/__init__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py
index 9a58dc6..cc48ce3 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -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