-## clean out existing lys and generated files
-map (os.remove, glob.glob (os.path.join (lys_from_lsr, '*.ly')) +
- glob.glob (os.path.join (lys_from_lsr, '*.snippet-list')))
+## clean out existing lys and generated files - but when we're
+## not recreating all of them from the tarball don't delete
+## snippets that came from LSR.
+if in_dir:
+ map (os.remove, glob.glob (os.path.join (lys_from_lsr, '*.ly')) +
+ glob.glob (os.path.join (lys_from_lsr, '*.snippet-list')))
+else:
+ map (os.remove, glob.glob (os.path.join (lys_from_lsr, '*.snippet-list')))
+ for f in glob.glob (os.path.join (lys_from_lsr, '*.ly')):
+ if new_lys_marker in open (f).read ():
+ os.remove (f)
+snippets = {}
+if in_dir:
+ # read LSR source where tags are defined by subdirs
+ snippets = read_source_with_dirs (in_dir)
+
+# read Documentation/snippets/new where tags are directly defined
+snippets_new, not_used_list = read_source (new_lys)
+snippets.update (snippets_new)