[Python-checkins] r66259 - doctools/trunk/setup.py

georg.brandl python-checkins at python.org
Sat Sep 6 19:39:32 CEST 2008


Author: georg.brandl
Date: Sat Sep  6 19:39:32 2008
New Revision: 66259

Log:
Fix warning when json is not available.


Modified:
   doctools/trunk/setup.py

Modified: doctools/trunk/setup.py
==============================================================================
--- doctools/trunk/setup.py	(original)
+++ doctools/trunk/setup.py	Sat Sep  6 19:39:32 2008
@@ -5,6 +5,7 @@
 import os
 import sys
 from setuptools import setup
+from distutils import log
 
 import sphinx
 
@@ -63,14 +64,16 @@
 try:
     from babel.messages.pofile import read_po
     from babel.messages.frontend import compile_catalog
-    from simplejson import dump
-    from distutils import log
+    try:
+        from simplejson import dump
+    except ImportError:
+        from json import dump
 except ImportError:
     class compile_catalog_plusjs(compile_catalog):
         def run(self):
             compile_catalog.run(self)
-            log.warning('simplejson or babel is not available; not writing '
-                        'JavaScript translation files.')
+            log.warn('simplejson/json or babel is not available; not writing '
+                     'JavaScript translation files.')
 else:
     class compile_catalog_plusjs(compile_catalog):
         """


More information about the Python-checkins mailing list