tool_shed.galaxy_install package

Subpackages

Submodules

tool_shed.galaxy_install.dependency_display module

class tool_shed.galaxy_install.dependency_display.DependencyDisplayer(app)[source]

Bases: object

__init__(app)[source]
add_installation_directories_to_tool_dependencies(tool_dependencies)[source]

Determine the path to the installation directory for each of the received tool dependencies. This path will be displayed within the tool dependencies container on the select_tool_panel_section or reselect_tool_panel_section pages when installing or reinstalling repositories that contain tools with the defined tool dependencies. The list of tool dependencies may be associated with more than a single repository.

generate_message_for_invalid_repository_dependencies(metadata_dict, error_from_tuple=False)[source]

Get or generate and return an error message associated with an invalid repository dependency.

generate_message_for_invalid_tool_dependencies(metadata_dict)[source]

Tool dependency definitions can only be invalid if they include a definition for a complex repository dependency and the repository dependency definition is invalid. This method retrieves the error message associated with the invalid tool dependency for display in the caller.

generate_message_for_orphan_tool_dependencies(repository, metadata_dict)[source]

The designation of a ToolDependency into the “orphan” category has evolved over time, and is significantly restricted since the introduction of the TOOL_DEPENDENCY_DEFINITION repository type. This designation is still critical, however, in that it handles the case where a repository contains both tools and a tool_dependencies.xml file, but the definition in the tool_dependencies.xml file is in no way related to anything defined by any of the contained tool’s requirements tag sets. This is important in that it is often a result of a typo (e.g., dependency name or version) that differs between the tool dependency definition within the tool_dependencies.xml file and what is defined in the tool config’s <requirements> tag sets. In these cases, the user should be presented with a warning message, and this warning message is is in fact displayed if the following is_orphan attribute is True. This is tricky because in some cases it may be intentional, and tool dependencies that are categorized as “orphan” are in fact valid.

get_installed_and_missing_tool_dependencies_for_installed_repository(repository, all_tool_dependencies)[source]

Return the lists of installed tool dependencies and missing tool dependencies for a Tool Shed repository that has been installed into Galaxy.

merge_containers_dicts_for_new_install(containers_dicts)[source]

When installing one or more tool shed repositories for the first time, the received list of containers_dicts contains a containers_dict for each repository being installed. Since the repositories are being installed for the first time, all entries are None except the repository dependencies and tool dependencies. The entries for missing dependencies are all None since they have previously been merged into the installed dependencies. This method will merge the dependencies entries into a single container and return it for display.

merge_missing_repository_dependencies_to_installed_container(containers_dict)[source]

Merge the list of missing repository dependencies into the list of installed repository dependencies.

merge_missing_tool_dependencies_to_installed_container(containers_dict)[source]

Merge the list of missing tool dependencies into the list of installed tool dependencies.

populate_containers_dict_for_new_install(tool_shed_url, tool_path, readme_files_dict, installed_repository_dependencies, missing_repository_dependencies, installed_tool_dependencies, missing_tool_dependencies, updating=False)[source]

Return the populated containers for a repository being installed for the first time or for an installed repository that is being updated and the updates include newly defined repository (and possibly tool) dependencies.

populate_containers_dict_from_repository_metadata(tool_shed_url, tool_path, repository, reinstalling=False, required_repo_info_dicts=None)[source]

Retrieve necessary information from the received repository’s metadata to populate the containers_dict for display. This method is called only from Galaxy (not the tool shed) when displaying repository dependencies for installed repositories and when displaying them for uninstalled repositories that are being reinstalled.

populate_tool_dependencies_dicts(tool_shed_url, tool_path, repository_installed_tool_dependencies, repository_missing_tool_dependencies, required_repo_info_dicts)[source]

Return the populated installed_tool_dependencies and missing_tool_dependencies dictionaries for all repositories defined by entries in the received required_repo_info_dicts.

tool_dependency_is_orphan(type, name, version, tools)[source]

Determine if the combination of the received type, name and version is defined in the <requirement> tag for at least one tool in the received list of tools. If not, the tool dependency defined by the combination is considered an orphan in its repository in the tool shed.

tool_shed.galaxy_install.install_manager module

class tool_shed.galaxy_install.install_manager.InstallRepositoryManager(app, tpm=None)[source]

Bases: object

__init__(app, tpm=None)[source]
get_repository_components_for_installation(encoded_tsr_id, encoded_tsr_ids, repo_info_dicts, tool_panel_section_keys)[source]

The received encoded_tsr_ids, repo_info_dicts, and tool_panel_section_keys are 3 lists that contain associated elements at each location in the list. This method will return the elements from repo_info_dicts and tool_panel_section_keys associated with the received encoded_tsr_id by determining its location in the received encoded_tsr_ids list.

handle_tool_shed_repositories(installation_dict)[source]
initiate_repository_installation(installation_dict)[source]
install(tool_shed_url, name, owner, changeset_revision, install_options)[source]
install_repositories(tsr_ids, decoded_kwd, reinstalling)[source]
install_tool_shed_repository(tool_shed_repository, repo_info_dict, tool_panel_section_key, shed_tool_conf, tool_path, install_resolver_dependencies, install_tool_dependencies, reinstalling=False, tool_panel_section_mapping={})[source]
order_components_for_installation(tsr_ids, repo_info_dicts, tool_panel_section_keys)[source]

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

update_tool_shed_repository_status(tool_shed_repository, status, error_message=None)[source]

Update the status of a tool shed repository in the process of being installed into Galaxy.

class tool_shed.galaxy_install.install_manager.InstallToolDependencyManager(app)[source]

Bases: object

__init__(app)[source]
format_traceback()[source]
get_tool_shed_repository_install_dir(tool_shed_repository)[source]
install_and_build_package(install_environment, tool_dependency, actions_dict)[source]

Install a Galaxy tool dependency package either via a url or a mercurial or git clone command.

install_and_build_package_via_fabric(install_environment, tool_shed_repository, tool_dependency, actions_dict)[source]
install_package(elem, tool_shed_repository, tool_dependencies=None, from_tool_migration_manager=False)[source]

Install a tool dependency package defined by the XML element elem. The value of tool_dependencies is a partial or full list of ToolDependency records associated with the tool_shed_repository.

install_specified_tool_dependencies(tool_shed_repository, tool_dependencies_config, tool_dependencies, from_tool_migration_manager=False)[source]

Follow the recipe in the received tool_dependencies_config to install specified packages for repository tools. The received list of tool_dependencies are the database records for those dependencies defined in the tool_dependencies_config that are to be installed. This list may be a subset of the set of dependencies defined in the tool_dependencies_config. This allows for filtering out dependencies that have not been checked for installation on the ‘Manage tool dependencies’ page for an installed Tool Shed repository.

install_via_fabric(tool_shed_repository, tool_dependency, install_dir, package_name=None, custom_fabfile_path=None, actions_elem=None, action_elem=None, **kwd)[source]

Parse a tool_dependency.xml file’s <actions> tag set to gather information for installation using self.install_and_build_package(). The use of fabric is being eliminated, so some of these functions may need to be renamed at some point.

mark_tool_dependency_installed(tool_dependency)[source]
exception tool_shed.galaxy_install.install_manager.RepositoriesInstalledException[source]

Bases: galaxy.exceptions.RequestParameterInvalidException

__init__()[source]
tool_shed.galaxy_install.install_manager.fetch_tool_versions(app, tool_shed_repository)[source]

Fetch a data structure describing tool shed versions from the tool shed corresponding to a tool_shed_repository object.

tool_shed.galaxy_install.installed_repository_manager module

Class encapsulating the management of repositories installed into Galaxy from the Tool Shed.

class tool_shed.galaxy_install.installed_repository_manager.InstalledRepositoryManager(app)[source]

Bases: object

__init__(app)[source]

Among other things, keep in in-memory sets of tuples defining installed repositories and tool dependencies along with the relationships between each of them. This will allow for quick discovery of those repositories or components that can be uninstalled. The feature allowing a Galaxy administrator to uninstall a repository should not be available to repositories or tool dependency packages that are required by other repositories or their contents (packages). The uninstall feature should be available only at the repository hierarchy level where every dependency will be uninstalled. The exception for this is if an item (repository or tool dependency package) is not in an INSTALLED state - in these cases, the specific item can be uninstalled in order to attempt re-installation.

activate_repository(repository)[source]

Activate an installed tool shed repository that has been marked as deactivated.

add_entry_to_installed_repository_dependencies_of_installed_repositories(repository)[source]

Add an entry to self.installed_repository_dependencies_of_installed_repositories. A side-effect of this method is the population of self.installed_dependent_repositories_of_installed_repositories. Since this method discovers all repositories required by the received repository, it can use the list to add entries to the reverse dictionary.

add_entry_to_installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies(tool_dependency)[source]

Add an entry to self.installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies.

add_entry_to_installed_tool_dependencies_of_installed_repositories(repository)[source]

Add an entry to self.installed_tool_dependencies_of_installed_repositories.

add_entry_to_repository_dependencies_of_installed_repositories(repository)[source]

Add an entry to self.repository_dependencies_of_installed_repositories.

add_entry_to_runtime_tool_dependencies_of_installed_tool_dependencies(tool_dependency)[source]

Add an entry to self.runtime_tool_dependencies_of_installed_tool_dependencies.

add_entry_to_tool_dependencies_of_installed_repositories(repository)[source]

Add an entry to self.tool_dependencies_of_installed_repositories.

get_containing_repository_for_tool_dependency(tool_dependency_tup)[source]
get_dependencies_for_repository(tool_shed_url, repo_info_dict, includes_tool_dependencies, updating=False)[source]

Return dictionaries containing the sets of installed and missing tool dependencies and repository dependencies associated with the repository defined by the received repo_info_dict.

get_installed_and_missing_repository_dependencies(repository)[source]

Return the installed and missing repository dependencies for a tool shed repository that has a record in the Galaxy database, but may or may not be installed. In this case, the repository dependencies are associated with the repository in the database. Do not include a repository dependency if it is required only to compile a tool dependency defined for the dependent repository since these special kinds of repository dependencies are really a dependency of the dependent repository’s contained tool dependency, and only if that tool dependency requires compilation.

get_installed_and_missing_repository_dependencies_for_new_or_updated_install(repo_info_tuple)[source]

Parse the received repository_dependencies dictionary that is associated with a repository being installed into Galaxy for the first time and attempt to determine repository dependencies that are already installed and those that are not.

get_installed_and_missing_tool_dependencies_for_repository(tool_dependencies_dict)[source]

Return the lists of installed tool dependencies and missing tool dependencies for a set of repositories being installed into Galaxy.

get_repository_dependency_tups_for_installed_repository(repository, dependency_tups=None, status=None)[source]

Return a list of of tuples defining tool_shed_repository objects (whose status can be anything) required by the received repository. The returned list defines the entire repository dependency tree. This method is called only from Galaxy.

get_repository_install_dir(tool_shed_repository)[source]
get_repository_tuple_for_installed_repository_manager(repository)[source]
get_runtime_dependent_tool_dependency_tuples(tool_dependency, status=None)[source]

Return the list of tool dependency objects that require the received tool dependency at run time. The returned list will be filtered by the received status if it is not None. This method is called only from Galaxy.

get_tool_dependency_tuple_for_installed_repository_manager(tool_dependency)[source]
handle_existing_tool_dependencies_that_changed_in_update(repository, original_dependency_dict, new_dependency_dict)[source]

This method is called when a Galaxy admin is getting updates for an installed tool shed repository in order to cover the case where an existing tool dependency was changed (e.g., the version of the dependency was changed) but the tool version for which it is a dependency was not changed. In this case, we only want to determine if any of the dependency information defined in original_dependency_dict was changed in new_dependency_dict. We don’t care if new dependencies were added in new_dependency_dict since they will just be treated as missing dependencies for the tool.

handle_repository_install(repository)[source]

Load the dependency relationships for a repository that was just installed or reinstalled.

handle_repository_uninstall(repository)[source]

Remove the dependency relationships for a repository that was just uninstalled.

handle_tool_dependency_install(repository, tool_dependency)[source]

Load the dependency relationships for a tool dependency that was just installed independently of its containing repository.

load_dependency_relationships()[source]

Load relationships for all installed repositories and tool dependencies into in-memnory dictionaries.

load_proprietary_converters_and_display_applications(deactivate=False)[source]
load_proprietary_datatypes()[source]
purge_repository(repository)[source]

Purge a repository with status New (a white ghost) from the database.

remove_entry_from_installed_repository_dependencies_of_installed_repositories(repository)[source]

Remove an entry from self.installed_repository_dependencies_of_installed_repositories. A side-effect of this method is removal of appropriate value items from self.installed_dependent_repositories_of_installed_repositories.

remove_entry_from_installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies(tool_dependency)[source]

Remove an entry from self.installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies.

remove_entry_from_installed_tool_dependencies_of_installed_repositories(repository)[source]

Remove an entry from self.installed_tool_dependencies_of_installed_repositories.

remove_entry_from_repository_dependencies_of_installed_repositories(repository)[source]

Remove an entry from self.repository_dependencies_of_installed_repositories.

remove_entry_from_runtime_tool_dependencies_of_installed_tool_dependencies(tool_dependency)[source]

Remove an entry from self.runtime_tool_dependencies_of_installed_tool_dependencies.

remove_entry_from_tool_dependencies_of_installed_repositories(repository)[source]

Remove an entry from self.tool_dependencies_of_installed_repositories.

repository_dependency_needed_only_for_compiling_tool_dependency(repository, repository_dependency)[source]
set_only_if_compiling_contained_td(repository, required_repository)[source]

Return True if the received required_repository is only needed to compile a tool dependency defined for the received repository.

set_prior_installation_required(repository, required_repository)[source]

Return True if the received required_repository must be installed before the received repository.

update_existing_tool_dependency(repository, original_dependency_dict, new_dependencies_dict)[source]

Update an exsiting tool dependency whose definition was updated in a change set pulled by a Galaxy administrator when getting updates to an installed tool shed repository. The original_dependency_dict is a single tool dependency definition, an example of which is:

{"name": "bwa",
 "readme": "\nCompiling BWA requires zlib and libpthread to be present on your system.\n        ",
 "type": "package",
 "version": "0.6.2"}

The new_dependencies_dict is the dictionary generated by the metadata_util.generate_tool_dependency_metadata method.

tool_shed.galaxy_install.repair_repository_manager module

class tool_shed.galaxy_install.repair_repository_manager.RepairRepositoryManager(app)[source]
__init__(app)[source]
get_installed_repositories_from_repository_dependencies(repository_dependencies_dict)[source]
get_repair_dict(repository)[source]

Inspect the installed repository dependency hierarchy for a specified repository and attempt to make sure they are all properly installed as well as each repository’s tool dependencies. This method is called only from Galaxy when attempting to correct issues with an installed repository that has installation problems somewhere in its dependency hierarchy. Problems with dependencies that have never been installed cannot be resolved with a repair.

get_repo_info_dict_for_repair(rdim, repository)[source]
repair_tool_shed_repository(repository, repo_info_dict)[source]

tool_shed.galaxy_install.tool_migration_manager module

Manage automatic installation of tools configured in the xxx.xml files in ~/scripts/migrate_tools (e.g., 0002_tools.xml). All of the tools were at some point included in the Galaxy distribution, but are now hosted in the main Galaxy tool shed.

class tool_shed.galaxy_install.tool_migration_manager.ToolMigrationManager(app, latest_migration_script_number, tool_shed_install_config, migrated_tools_config, install_dependencies)[source]

Bases: object

__init__(app, latest_migration_script_number, tool_shed_install_config, migrated_tools_config, install_dependencies)[source]

Check tool settings in tool_shed_install_config and install all repositories that are not already installed. The tool panel configuration file is the received migrated_tools_config, which is the reserved file named migrated_tools_conf.xml.

create_or_update_tool_shed_repository_record(name, owner, changeset_revision, description=None)[source]
create_or_update_tool_shed_repository_records(name, changeset_revision, repository_dependencies_dict)[source]

Make sure the repository defined by name and changeset_revision and all of its repository dependencies have associated tool_shed_repository table rows in the Galaxy database.

filter_and_persist_proprietary_tool_panel_configs(tool_configs_to_filter)[source]

Eliminate all entries in all non-shed-related tool panel configs for all tool config file names in the received tool_configs_to_filter.

get_containing_tool_sections(tool_config)[source]

If tool_config is defined somewhere in self.proprietary_tool_panel_elems, return True and a list of ToolSections in which the tool is displayed. If the tool is displayed outside of any sections, None is appended to the list.

get_guid(repository_clone_url, relative_install_dir, tool_config)[source]
get_prior_install_required_dict(tool_shed_repositories, repository_dependencies_dict)[source]

Return a dictionary whose keys are the received tsr_ids and whose values are a list of tsr_ids, each of which is contained in the received list of tsr_ids and whose associated repository must be installed prior to the repository associated with the tsr_id key.

get_proprietary_tool_panel_elems(latest_tool_migration_script_number)[source]

Parse each config in self.proprietary_tool_confs (the default is tool_conf.xml) and generate a list of Elements that are either ToolSection elements or Tool elements. These will be used to generate new entries in the migrated_tools_conf.xml file for the installed tools.

handle_repository_contents(tool_shed_repository, repository_clone_url, relative_install_dir, repository_elem, install_dependencies, is_repository_dependency=False)[source]

Generate the metadata for the installed tool shed repository, among other things. If the installed tool_shed_repository contains tools that are loaded into the Galaxy tool panel, this method will automatically eliminate all entries for each of the tools defined in the received repository_elem from all non-shed-related tool panel configuration files since the entries are automatically added to the reserved migrated_tools_conf.xml file as part of the migration process.

install_repository(repository_elem, tool_shed_repository, install_dependencies, is_repository_dependency=False)[source]

Install a single repository, loading contained tools into the tool panel.

non_shed_tool_panel_configs
order_repositories_for_installation(tool_shed_repositories, repository_dependencies_dict)[source]

Some repositories may have repository dependencies that are required to be installed before the dependent repository. This method will inspect the list of repositories about to be installed and make sure to order them appropriately. For each repository about to be installed, if required repositories are not contained in the list of repositories about to be installed, then they are not considered. Repository dependency definitions that contain circular dependencies should not result in an infinite loop, but obviously prior installation will not be handled for one or more of the repositories that require prior installation. This process is similar to the process used when installing tool shed repositories, but does not handle managing tool panel sections and other components since repository dependency definitions contained in tool shed repositories with migrated tools must never define a relationship to a repository dependency that contains a tool.

tool_shed.galaxy_install.update_repository_manager module

Determine if installed tool shed repositories have updates available in their respective tool sheds.

class tool_shed.galaxy_install.update_repository_manager.Sleeper[source]

Bases: object

Provides a ‘sleep’ method that sleeps for a number of seconds unless the notify method is called (from a different thread).

__init__()[source]
sleep(seconds)[source]
wake()[source]
class tool_shed.galaxy_install.update_repository_manager.UpdateRepositoryManager(app)[source]

Bases: object

__init__(app)[source]
get_update_to_changeset_revision_and_ctx_rev(repository)[source]

Return the changeset revision hash to which the repository can be updated.

shutdown()[source]
update_repository_record(repository, updated_metadata_dict, updated_changeset_revision, updated_ctx_rev)[source]

Update a tool_shed_repository database record with new information retrieved from the Tool Shed. This happens when updating an installed repository to a new changeset revision.