3 # Tool for copying cumulus archives from one source to another.
7 # Automatically set Python path, based on script directory. This should be
8 # removed if the tools are properly installed somewhere.
9 script_directory = os.path.dirname(sys.argv[0])
10 sys.path.append(os.path.join(script_directory, 'python'))
15 store1 = cumulus.store.open(sys.argv[1])
16 store2 = cumulus.store.open(sys.argv[2])
18 source = cumulus.ObjectStore(cumulus.LowlevelDataStore(store1))
21 for s in sys.argv[3:]:
23 d = cumulus.parse_full(source.load_snapshot(s))
24 filter.update(d['Segments'].split())
26 for ty in ('segments', 'checksums', 'snapshots'):
27 for f in sorted(store1.list(ty)):
28 m = cumulus.store.type_patterns[ty].match(f)
30 if filter and m.group(1) not in filter:
36 except cumulus.store.NotFoundError:
37 store2.put(ty, f, store1.get(ty, f))