python,scons: Move grammar.py and code_formatter.py into build_tools.
These are only used in a build, and so don't need to be built into gem5. grammar.py is used by slicc and the fast model project file parser, and code_formatter.py is only used by SConscripts. Change-Id: Id43e62459d69f07fdb2ed125548a83e38bbb7590 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49396 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
@@ -126,6 +126,9 @@ AddOption('--with-systemc-tests', action='store_true',
|
||||
AddOption('--install-hooks', action='store_true',
|
||||
help='Install revision control hooks non-interactively')
|
||||
|
||||
# Inject the built_tools directory into the python path.
|
||||
sys.path[1:1] = [ Dir('#build_tools').abspath ]
|
||||
|
||||
# Imports of gem5_scons happen here since it depends on some options which are
|
||||
# declared above.
|
||||
from gem5_scons import error, warning, summarize_warnings, parse_build_path
|
||||
|
||||
@@ -42,7 +42,7 @@ import os.path
|
||||
from gem5_scons import Transform, MakeAction
|
||||
from gem5_scons.util import bytesToCppArray
|
||||
|
||||
from m5.util import code_formatter
|
||||
from code_formatter import code_formatter
|
||||
|
||||
import SCons.Node.Python
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ Export('env')
|
||||
|
||||
build_env = [(opt, env[opt]) for opt in export_vars]
|
||||
|
||||
from m5.util import code_formatter
|
||||
from code_formatter import code_formatter
|
||||
|
||||
def GdbXml(xml_id, symbol):
|
||||
cc, hh = env.Blob(symbol, xml_id)
|
||||
|
||||
@@ -40,7 +40,7 @@ import shlex
|
||||
|
||||
Import('*')
|
||||
|
||||
from m5.util.grammar import Grammar
|
||||
from grammar import Grammar
|
||||
|
||||
from gem5_scons import Transform, warning, error
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import traceback
|
||||
# get type names
|
||||
from types import *
|
||||
|
||||
from m5.util.grammar import Grammar
|
||||
from grammar import Grammar
|
||||
from .operand_list import *
|
||||
from .operand_types import *
|
||||
from .util import *
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from m5.util.code_formatter import code_formatter
|
||||
|
||||
def printDotty(sm, code):
|
||||
code('digraph ${{sm.getIdent()}} {')
|
||||
code.indent()
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from m5.util.code_formatter import code_formatter
|
||||
from code_formatter import code_formatter
|
||||
|
||||
def createSymbol(symbol, title):
|
||||
code = code_formatter()
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from m5.util.code_formatter import code_formatter
|
||||
from code_formatter import code_formatter
|
||||
|
||||
class tex_formatter(code_formatter):
|
||||
braced = "<>"
|
||||
|
||||
@@ -41,8 +41,8 @@ import os.path
|
||||
import re
|
||||
import sys
|
||||
|
||||
from m5.util import code_formatter
|
||||
from m5.util.grammar import Grammar, ParseError
|
||||
from code_formatter import code_formatter
|
||||
from grammar import Grammar, ParseError
|
||||
|
||||
import slicc.ast as ast
|
||||
import slicc.util as util
|
||||
|
||||
@@ -190,12 +190,10 @@ PySource('m5.objects', 'm5/objects/__init__.py')
|
||||
PySource('m5.stats', 'm5/stats/__init__.py')
|
||||
PySource('m5.util', 'm5/util/__init__.py')
|
||||
PySource('m5.util', 'm5/util/attrdict.py')
|
||||
PySource('m5.util', 'm5/util/code_formatter.py')
|
||||
PySource('m5.util', 'm5/util/convert.py')
|
||||
PySource('m5.util', 'm5/util/dot_writer.py')
|
||||
PySource('m5.util', 'm5/util/dot_writer_ruby.py')
|
||||
PySource('m5.util', 'm5/util/fdthelper.py')
|
||||
PySource('m5.util', 'm5/util/grammar.py')
|
||||
PySource('m5.util', 'm5/util/multidict.py')
|
||||
PySource('m5.util', 'm5/util/pybind.py')
|
||||
PySource('m5.util', 'm5/util/terminal.py')
|
||||
|
||||
@@ -44,7 +44,6 @@ import sys
|
||||
from . import convert
|
||||
|
||||
from .attrdict import attrdict, multiattrdict, optiondict
|
||||
from .code_formatter import code_formatter
|
||||
from .multidict import multidict
|
||||
|
||||
# panic() should be called when something happens that should never
|
||||
|
||||
@@ -32,6 +32,7 @@ if __name__ == "__main__":
|
||||
base = dirname(__file__)
|
||||
sys.path.insert(1, join(base, "../src/mem"))
|
||||
sys.path.insert(1, join(base, "../src/python"))
|
||||
sys.path.insert(1, join(base, "../build_tools"))
|
||||
sys.path.insert(1, join(base, "../ext/ply"))
|
||||
|
||||
import slicc.main
|
||||
|
||||
Reference in New Issue
Block a user