tool_shed.capsule package

Submodules

tool_shed.capsule.capsule_manager module

class tool_shed.capsule.capsule_manager.ExportRepositoryManager(app, user, tool_shed_url, repository, changeset_revision, export_repository_dependencies, using_api)[source]

Bases: object

__init__(app, user, tool_shed_url, repository, changeset_revision, export_repository_dependencies, using_api)[source]
export_repository()[source]
generate_export_elem()[source]
generate_repository_archive(repository, changeset_revision, work_dir)[source]
generate_repository_archive_filename(use_tmp_archive_dir=False)[source]
get_components_from_repo_info_dict(repo_info_dict)[source]

Return the repository and the associated latest installable changeset_revision (including # updates) for the repository defined by the received repo_info_dict.

get_repo_info_dict_for_import(encoded_repository_id, encoded_repository_ids, repo_info_dicts)[source]

The received encoded_repository_ids and repo_info_dicts are lists that contain associated elements at each location in the list. This method will return the element from repo_info_dicts associated with the received encoded_repository_id by determining its location in the received encoded_repository_ids list.

get_repo_info_dicts()[source]

Return a list of dictionaries defining repositories that are required by the repository associated with self.repository_id.

get_repository_attributes_and_sub_elements(repository, archive_name)[source]

Get the information about a repository to create and populate an XML tag set. The generated attributes will be contained within the <repository> tag, while the sub_elements will be tag sets contained within the <repository> tag set.

get_repository_ids(repo_info_dicts)[source]

Return a list of repository ids associated with each dictionary in the received repo_info_dicts.

order_components_for_import(repository_ids, repo_info_dicts)[source]

Some repositories may have repository dependencies that must be imported and have metadata set on them before the dependent repository is imported. This method will inspect the list of repositories about to be exported and make sure to order them appropriately for proper import. For each repository about to be exported, if required repositories are not contained in the list of repositories about to be exported, then they are not considered. Repository dependency definitions that contain circular dependencies should not result in an infinite loop, but obviously ordering the list will not be handled for one or more of the repositories that require prior import.

remove_protocol_from_tool_shed_url()[source]
class tool_shed.capsule.capsule_manager.ExportedRepositoryRegistry[source]

Bases: object

__init__()[source]
class tool_shed.capsule.capsule_manager.ImportRepositoryManager(app, host, user, user_is_admin)[source]

Bases: object

__init__(app, host, user, user_is_admin)[source]
check_status_and_reset_downloadable(import_results_tups)[source]

Check the status of each imported repository and set downloadable to False if errors.

create_repository_and_import_archive(repository_archive_dict, import_results_tups)[source]

Create a new repository in the tool shed and populate it with the contents of a gzip compressed tar archive that was exported as part or all of the contents of a capsule.

extract_capsule_files(**kwd)[source]

Extract the uploaded capsule archive into a temporary location for inspection, validation and potential import.

get_archives_from_manifest(manifest_file_path)[source]

Return the list of archive names defined in the capsule manifest. This method will validate the manifest by ensuring all <repository> tag sets contain a valid <archive> sub-element.

get_dependent_downloadable_revisions(repository_metadata)[source]

Return all repository_metadata records that are downloadable and that depend upon the received repository_metadata record.

get_export_info_dict(export_info_file_path)[source]

Parse the export_info.xml file contained within the capsule and return a dictionary containing its entries.

get_repository_info_from_manifest(manifest_file_path)[source]

Parse the capsule manifest and return a list of dictionaries containing information about each exported repository archive contained within the capsule.

get_repository_status_from_tool_shed(repository_info_dicts)[source]

For each exported repository archive contained in the capsule, inspect the Tool Shed to see if that repository already exists or if the current user is authorized to create the repository and set a status appropriately. If repository dependencies are included in the capsule, repositories may have various owners. We will keep repositories associated with owners, so we need to restrict created repositories to those the current user can create. If the current user is an admin or a member of the IUC, all repositories will be created no matter the owner. Otherwise only repositories whose associated owner is the current user will be created.

import_repository_archive(repository, repository_archive_dict)[source]

Import a repository archive contained within a repository capsule.

upload_capsule(**kwd)[source]

Upload and prepare an exported repository capsule for validation.

validate_archive_paths(tar_archive)[source]

Inspect the archive contents to ensure that there are no risky symlinks. Returns True if a suspicious path is found.

validate_capsule(**kwd)[source]

Inspect the uploaded capsule’s manifest and its contained files to ensure it is a valid repository capsule.

verify_archives_in_capsule(file_path, archives)[source]

Inspect the files contained within the capsule and make sure each is defined correctly in the capsule manifest.