]> granicus.if.org Git - icu/commitdiff
ICU-10128 remove version suffixes from UCD files, so that they are easy to compare...
authorMarkus Scherer <markus.icu@gmail.com>
Tue, 30 Apr 2013 16:27:15 +0000 (16:27 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Tue, 30 Apr 2013 16:27:15 +0000 (16:27 +0000)
X-SVN-Rev: 33565

tools/unicode/py/preparseucd.py

index d821200c1cae8ac6e87bc334aad8b18d83e31a8f..56e115349a672bf9595834b76eb5f9ffa535fa39 100755 (executable)
@@ -1556,9 +1556,17 @@ def PreprocessFiles(source_files, icu_src_root):
   }
   files_processed = set()
   for source_file in source_files:
-    basename = os.path.basename(source_file)
+    (folder, basename) = os.path.split(source_file)
     match = _file_version_re.match(basename)
-    if match: basename = match.group(1) + match.group(2)
+    if match:
+      new_basename = match.group(1) + match.group(2)
+      if new_basename != basename:
+        print "Removing version suffix from " + source_file
+        # ... so that we can easily compare UCD files.
+        new_source_file = os.path.join(folder, new_basename)
+        shutil.move(source_file, new_source_file)
+        basename = new_basename
+        source_file = new_source_file
     if basename in _files:
       print "Preprocessing %s" % basename
       if basename in files_processed: