Fix __file__ for scripts
authorNathan Binkert <binkertn@umich.edu>
Wed, 12 Jul 2006 19:18:49 +0000 (15:18 -0400)
committerNathan Binkert <binkertn@umich.edu>
Wed, 12 Jul 2006 19:18:49 +0000 (15:18 -0400)
src/python/m5/main.py:
    set __file__ to the script, not the m5 binary.

--HG--
extra : convert_revision : a0bbd059d2fd321ae8ff68225abc8a7bb5c410ed

src/python/m5/main.py

index 904b241ca9c976575aeca209277a8279e33925b5..80dbcb5aaa5ca2c33da7c1c252a0e1006d7ab3e0 100644 (file)
@@ -283,9 +283,10 @@ def main():
     objects.ExecutionTrace.print_fetchseq = options.print_fetch_seq
     objects.ExecutionTrace.print_cpseq = options.print_cpseq
 
-    scope = { '__file__' : sys.argv[0] }
     sys.argv = arguments
     sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path
+
+    scope = { '__file__' : sys.argv[0] }
     exec("import readline", scope)
     execfile(sys.argv[0], scope)