Always return a count from carefully_make_hardlinks
authorDiane Trout <diane@caltech.edu>
Sat, 8 May 2010 00:32:32 +0000 (00:32 +0000)
committerDiane Trout <diane@caltech.edu>
Sat, 8 May 2010 00:32:32 +0000 (00:32 +0000)
Be more flexible about which json parser to use

scripts/make-library-tree

index f4e854a0fe4cd742a7481513f67455b70291b2e0..822af4829e2be4f88c889c61791888cb730f869e 100644 (file)
@@ -1,7 +1,12 @@
 #!/usr/bin/env python
 
 from ConfigParser import SafeConfigParser
-import json
+# try to deal with python <2.6
+try:
+  import json
+except ImportError:
+  import simplejson as json
+
 import logging
 import os
 from optparse import OptionParser
@@ -193,8 +198,9 @@ def carefully_make_hardlink(source, destination, dry_run=False):
             logging.debug('SAME: %s -> %s' % (source, destination))
             return 0
         else:
-            raise IOError('%s and %s are different files' % \
-                           (source, destination))
+            logging.error('%s and %s are different files, skipping' % \
+                          (source, destination)) 
+            return 0
     logging.debug('Linking: %s -> %s' % (source, destination))
 
     # we would do something by this part