This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

tool_shed.capsule package


tool_shed.capsule.capsule_manager module

class tool_shed.capsule.capsule_manager.ExportedRepositoryRegistry[source]

Bases: object

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]
generate_repository_archive(repository, changeset_revision, work_dir)[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.


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.


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.

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 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 the uploaded capsule archive into a temporary location for inspection, validation and potential import.


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.


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


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


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


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 and prepare an exported repository capsule for validation.


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


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.