changeset 380a32b43336 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=380a32b43336
description:
        scons: add slicc and ply to sys.path and PYTHONPATH so everyone has 
access

diffstat:

4 files changed, 12 insertions(+), 17 deletions(-)
SConstruct                  |   19 ++++++++++++-------
src/arch/isa_parser.py      |    5 -----
src/arch/micro_asm.py       |    4 ----
src/mem/protocol/SConscript |    1 -

diffs (97 lines):

diff -r 4c84e771cca7 -r 380a32b43336 SConstruct
--- a/SConstruct        Tue Sep 22 15:24:16 2009 -0700
+++ b/SConstruct        Tue Sep 22 15:24:16 2009 -0700
@@ -111,8 +111,12 @@
 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 @@
 #
 ########################################################################
 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.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 @@
 # 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 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'):
diff -r 4c84e771cca7 -r 380a32b43336 src/arch/isa_parser.py
--- a/src/arch/isa_parser.py    Tue Sep 22 15:24:16 2009 -0700
+++ b/src/arch/isa_parser.py    Tue Sep 22 15:24:16 2009 -0700
@@ -34,11 +34,6 @@
 # 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
 
diff -r 4c84e771cca7 -r 380a32b43336 src/arch/micro_asm.py
--- a/src/arch/micro_asm.py     Tue Sep 22 15:24:16 2009 -0700
+++ b/src/arch/micro_asm.py     Tue Sep 22 15:24:16 2009 -0700
@@ -34,10 +34,6 @@
 # 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
 
diff -r 4c84e771cca7 -r 380a32b43336 src/mem/protocol/SConscript
--- a/src/mem/protocol/SConscript       Tue Sep 22 15:24:16 2009 -0700
+++ b/src/mem/protocol/SConscript       Tue Sep 22 15:24:16 2009 -0700
@@ -73,7 +73,6 @@
 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])
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to