python,scons: Break slicc's dependence on m5.util.
The only dependence remaining was a small utility function makeDir which was only used by slicc. This change moves it to where it's used, and cleans up the additions to sys.path a little. Change-Id: I7415b53ea2e9c378b6dbf342b8b3a966f48e117c Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49397 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
@@ -25,13 +25,22 @@
|
||||
# (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 import makeDir
|
||||
import os
|
||||
|
||||
from slicc.generate import html
|
||||
from slicc.symbols.StateMachine import StateMachine
|
||||
from slicc.symbols.Type import Type
|
||||
from slicc.util import Location
|
||||
|
||||
def makeDir(path):
|
||||
"""Make a directory if it doesn't exist. If the path does exist,
|
||||
ensure that it is a directory"""
|
||||
if os.path.exists(path):
|
||||
if not os.path.isdir(path):
|
||||
raise AttributeError("%s exists but is not directory" % path)
|
||||
else:
|
||||
os.mkdir(path)
|
||||
|
||||
class SymbolTable(object):
|
||||
def __init__(self, slicc):
|
||||
self.slicc = slicc
|
||||
|
||||
@@ -155,15 +155,6 @@ def printList(items, indent=4):
|
||||
line += item
|
||||
print(line)
|
||||
|
||||
def makeDir(path):
|
||||
"""Make a directory if it doesn't exist. If the path does exist,
|
||||
ensure that it is a directory"""
|
||||
if os.path.exists(path):
|
||||
if not os.path.isdir(path):
|
||||
raise AttributeError("%s exists but is not directory" % path)
|
||||
else:
|
||||
os.mkdir(path)
|
||||
|
||||
def isInteractive():
|
||||
"""Check if the simulator is run interactively or in a batch environment"""
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ 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"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user