Module gamster.create_bag¶
The create_bagmodule provides function to convert an object directory
into a GAMS bag.
The most important function is make_bag()
gamster.create_bag
¶
Create a Bagit directory from object folders.
write_manifest_md5
¶
Write the manifest-md5.txt file to the bagit object folder.
write_manifest_sha512
¶
Write the manifest-sha512.txt file to the bagit object folder.
write_bag_info_txt
¶
Write the bag-info.txt file to the bagit object folder.
cleanup_bag_dir
¶
Check if the bag (either a folder or a zip archive) already exists and remove it if overwrite_bag is True.
Raises BagExistsError if the bag directory or bag zip archive already exists and overwrite_bag is False.
If overwrite_bag is True, a warning is issued and the existing bag directory and/or zip archive is removed before creating a new bag directory.
create_temporary_bag_dir
¶
Create a temporary Bagit directory for the object folder.
The temporary directory will be created in the system's temp directory. Purpose is to prepare the bagit structure and files and to validate the bag before moving it to the final location.
Returns the path to the temporary directory.
make_bag
¶
Create a Bagit directory for files in object_dir.
The resulting directory will be created under the output_root directory. Returns the path of the created bag directory. Raises BagExistsError if the bag directory already exists and overwrite_bag is False. Raises gamslib.sip.BagValidationError if the bag validation fails.