Author: Anton Gulenko <[email protected]>
Branch: 
Changeset: r76868:4e43d96d9d48
Date: 2015-02-22 11:43 +0100
http://bitbucket.org/pypy/pypy/changeset/4e43d96d9d48/

Log:    Removed pdb, added warning message and made more robust.

diff --git a/rpython/rlib/rstrategies/logparser.py 
b/rpython/rlib/rstrategies/logparser.py
--- a/rpython/rlib/rstrategies/logparser.py
+++ b/rpython/rlib/rstrategies/logparser.py
@@ -12,7 +12,7 @@
 If the name of the logfile includes one of the AVAILABLE_VMS as a substring, 
the first three global variables
 are automatically configured.
 The script should work without these configurations, but the output will 
probably not be that pretty.
-To avoid errors, use the -a flag when running without proper configuration.
+To avoid errors, the -a flag is implied when running without proper 
configuration.
 """
 
 # This should contain a full list of storage nodes (strategies).
@@ -45,6 +45,21 @@
 
 AVAILABLE_VMS = ['RSqueak', 'Pycket', 'Topaz']
 
+def configure_vm(logfile, flags):
+    vm_config_name = None
+    for vm_name in AVAILABLE_VMS:
+        if vm_name in logfile:
+            vm_config_name = vm_name
+            break
+    if vm_config_name is not None:
+        print "Using VM configuration %s" % vm_name
+        SET_VM(vm_name)
+    else:
+        print "No VM configuration found in filename '%s'. Available 
configurations: %s" % \
+                (logfile, AVAILABLE_VMS)
+        print "Please add new VM configuration or rename logfile. Turning on 
-a flag to avoid errors."
+        flags.allstorage = True
+
 # ====================================================================
 # ======== Logfile parsing
 # ====================================================================
@@ -370,8 +385,6 @@
         self.operations = set()
     
     def node(self, name):
-        if str(name) == 'None':
-            import pdb; pdb.set_trace()
         if name not in self.nodes:
             self.nodes[name] = StorageNode(name)
         return self.nodes[name]
@@ -666,11 +679,7 @@
         usage(flags, commands)
     logfile = argv[0]
     flags.logfile = logfile
-    for vm_name in AVAILABLE_VMS:
-        if vm_name in logfile:
-            print "Using VM configuration %s" % vm_name
-            SET_VM(vm_name)
-            break
+    configure_vm(logfile, flags)
     command = argv[1]
     for flag in argv[2:]:
         if not flags.handle(flag):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to