server/schemaserial.py
changeset 10375 28ec01db78b3
parent 10191 cc4b8021bdf3
child 10411 4ee15441f2eb
--- a/server/schemaserial.py	Tue May 05 15:49:41 2015 +0200
+++ b/server/schemaserial.py	Fri Jun 12 09:18:02 2015 +0200
@@ -21,8 +21,9 @@
 
 import os
 import json
+import sys
 
-from logilab.common.shellutils import ProgressBar
+from logilab.common.shellutils import ProgressBar, DummyProgressBar
 
 from yams import (BadSchemaDefinition, schema as schemamod, buildobjs as ybo,
                   schema2sql as y2sql)
@@ -350,7 +351,10 @@
     pb_size = (len(eschemas + schema.relations())
                + len(CONSTRAINTS)
                + len([x for x in eschemas if x.specializes()]))
-    pb = ProgressBar(pb_size, title=_title)
+    if sys.stdout.isatty():
+        pb = ProgressBar(pb_size, title=_title)
+    else:
+        pb = DummyProgressBar()
     groupmap = group_mapping(cnx, interactive=False)
     # serialize all entity types, assuring CWEType is serialized first for proper
     # is / is_instance_of insertion