scons: add slicc and ply to sys.path and PYTHONPATH so everyone has access
authorNathan Binkert <nate@binkert.org>
Tue, 22 Sep 2009 22:24:16 +0000 (15:24 -0700)
committerNathan Binkert <nate@binkert.org>
Tue, 22 Sep 2009 22:24:16 +0000 (15:24 -0700)
SConstruct
src/arch/isa_parser.py
src/arch/micro_asm.py
src/mem/protocol/SConscript

index e34d60ec8521c1d5622ff78e7e724d95b6622df5..f143bca0e73f4535b1f2cb668ed983901fd1a2e8 100644 (file)
@@ -111,8 +111,12 @@ from os.path import join as joinpath, split as splitpath
 import SCons
 import SCons.Node
 
-# M5 includes
-sys.path[1:1] = [ Dir('src/python').srcnode().abspath ]
+extra_python_paths = [
+    Dir('src/python').srcnode().abspath, # M5 includes
+    Dir('ext/ply').srcnode().abspath, # ply is used by several files
+    ]
+    
+sys.path[1:1] = extra_python_paths
 
 from m5.util import compareVersions, readCommand
 
@@ -122,7 +126,7 @@ from m5.util import compareVersions, readCommand
 #
 ########################################################################
 use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH', 'PATH',
-                 'RANLIB' ])
+                 'PYTHONPATH', 'RANLIB' ])
 
 use_env = {}
 for key,val in os.environ.iteritems():
@@ -133,6 +137,10 @@ main = Environment(ENV=use_env)
 main.root = Dir(".")         # The current directory (where this file lives).
 main.srcdir = Dir("src")     # The source directory
 
+# add useful python code PYTHONPATH so it can be used by subprocesses
+# as well
+main.AppendENVPath('PYTHONPATH', extra_python_paths)
+
 ########################################################################
 #
 # Mercurial Stuff.
@@ -338,9 +346,6 @@ Export('extras_dir_list')
 # the ext directory should be on the #includes path
 main.Append(CPPPATH=[Dir('ext')])
 
-# M5_PLY is used by isa_parser.py to find the PLY package.
-main.Append(ENV = { 'M5_PLY' : Dir('ext/ply').abspath })
-
 CXX_version = readCommand([main['CXX'],'--version'], exception=False)
 CXX_V = readCommand([main['CXX'],'-V'], exception=False)
 
@@ -386,7 +391,7 @@ if main['BATCH']:
 
 if sys.platform == 'cygwin':
     # cygwin has some header file issues...
-    main.Append(CCFLAGS=Split("-Wno-uninitialized"))
+    main.Append(CCFLAGS="-Wno-uninitialized")
 
 # Check for SWIG
 if not main.has_key('SWIG'):
index d5b5bbe4f9c56586082475689918e2ffc335da2c..23260ca481d859269daabf50fdcc7402e474f0d3 100755 (executable)
@@ -34,11 +34,6 @@ import traceback
 # get type names
 from types import *
 
-# Prepend the directory where the PLY lex & yacc modules are found
-# to the search path.  Assumes we're compiling in a subdirectory
-# of 'build' in the current tree.
-sys.path[0:0] = [os.environ['M5_PLY']]
-
 from ply import lex
 from ply import yacc
 
index 3433a80763ae766f6df1a6c129d1b048d06279dd..4e5400ceffe8d075ecf935cc64f6b9968aef7184 100644 (file)
@@ -34,10 +34,6 @@ import traceback
 # get type names
 from types import *
 
-# Prepend the directory where the PLY lex & yacc modules are found
-# to the search path.
-sys.path[0:0] = [os.environ['M5_PLY']]
-
 from ply import lex
 from ply import yacc
 
index 293346f13bfad46f2c64e734005b09fb323af344..700ab40ea6250556183befac789f38fb8055b5e2 100644 (file)
@@ -73,7 +73,6 @@ protocol = env['PROTOCOL']
 sources = [ protocol_dir.File("RubySlicc_interfaces.slicc"),
             protocol_dir.File("%s.slicc" % protocol) ]
 
-sys.path[0:0] = [env['ENV']['M5_PLY']]
 execfile(slicc_dir.File('parser/parser.py').srcnode().abspath)
 
 sm_files = read_slicc([s.srcnode().abspath for s in sources])