]> git.donarmstrong.com Git - lilypond.git/blobdiff - buildscripts/output-distance.py
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / buildscripts / output-distance.py
index 1e25c1813a54ce17f0514036e4cd909ee2967a95..a19380f1f28b4c9cfbd4aad84749d89e3c733954 100644 (file)
@@ -2,10 +2,6 @@
 import sys
 import optparse
 
-
-## so we can call directly as buildscripts/output-distance.py
-sys.path.insert (0, '../python')
-
 import safeeval
 
 
@@ -221,13 +217,10 @@ class ComparisonData:
     def compare_trees (self, dir1, dir2):
         self.compare_directories (dir1, dir2)
         
-        (root, dirs, files) = os.walk (dir1).next ()
+        (root, files, dirs) = os.walk (dir1).next ()
         for d in dirs:
             d1 = os.path.join (dir1, d)
             d2 = os.path.join (dir2, d)
-
-            if os.path.islink (d1) or os.path.islink (d2):
-                continue
             
             if os.path.isdir (d2):
                 self.compare_trees (d1, d2)
@@ -244,7 +237,7 @@ class ComparisonData:
             f1 = dir1 +  '/' + p
             distance = compare_signature_files (f1, f2)
             self.result_dict[f2] = (distance, f1)
-
+    
     def create_text_result_page (self, dir1, dir2):
         self.write_text_result_page (dir2 + '/' + os.path.split (dir1)[1] + '.txt')
         
@@ -282,29 +275,19 @@ class ComparisonData:
 
         results.sort ()
         results.reverse ()
-        
+
         html = ''
         old_prefix = os.path.split (dir1)[1]
-
-        dest_dir = os.path.join (dir2, old_prefix)
-        shutil.rmtree  (dest_dir, ignore_errors=True)
-        os.mkdir (dest_dir)
-        for (score, oldfile, newfile) in results:
-            
-            old_base = re.sub ("-[0-9]+.signature", '', oldfile)
-            old_name = os.path.split (old_base)[1]
+        os.mkdir (dir2 + '/' + old_prefix)
+        for (score, oldfile, newfile) in  results:
+            old_base = re.sub ("-[0-9]+.signature", '', os.path.split (oldfile)[1])
             new_base = re.sub ("-[0-9]+.signature", '', newfile)
             
             for ext in 'png', 'ly':
-                src_file = old_base + '.' + ext
-                
-                if os.path.exists (src_file):
-                    shutil.copy2 (src_file, dest_dir)
-                else:
-                    print "warning: can't find", src_file
+                shutil.copy2 (old_base + '.' + ext, dir2 + '/' + old_prefix)
 
-            img_1 = os.path.join (old_prefix, old_name + '.png')
-            ly_1 = os.path.join (old_prefix, old_name + '.ly')
+            img_1 = os.path.join (old_prefix, old_base + '.png')
+            ly_1 = os.path.join (old_prefix, old_base + '.ly')
 
             img_2 = new_base.replace (dir2, '') + '.png'
             img_2 = re.sub ("^/*", '', img_2)
@@ -352,11 +335,11 @@ class ComparisonData:
         
 
 def compare_trees (dir1, dir2):
-    data = ComparisonData ()
+    data =  ComparisonData ()
     data.compare_trees (dir1, dir2)
     data.print_results ()
     data.create_html_result_page (dir1, dir2)
-#    data.create_text_result_page (dir1, dir2)
+    data.create_text_result_page (dir1, dir2)
     
 ################################################################
 # TESTING