From: stevenknight Date: Tue, 28 Oct 2008 01:00:25 +0000 (+0000) Subject: Issue 2228: Add os.devnull to the SCons.compat layer. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8c73587a800ebbd80cb2243ae279f8723680965f;p=scons.git Issue 2228: Add os.devnull to the SCons.compat layer. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3741 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py index 9a58dc67..cc48ce3d 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