server/schemaserial.py
changeset 10411 4ee15441f2eb
parent 10365 21461f80f348
parent 10375 28ec01db78b3
child 10553 1d824df4f2bd
--- a/server/schemaserial.py	Mon Jun 22 14:15:16 2015 +0200
+++ b/server/schemaserial.py	Mon Jun 22 14:27:37 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
 
@@ -348,7 +349,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