def generate_tool_shed_repository_install_dir(repository_clone_url, changeset_revision): """ Generate a repository installation directory that guarantees repositories with the same name will always be installed in different directories. The tool path will be of the form: <tool shed url>/repos/<repository owner>/<repository name>/<installed changeset revision> """ tmp_url = common_util.remove_protocol_and_user_from_clone_url(repository_clone_url) # Now tmp_url is something like: bx.psu.edu:9009/repos/some_username/column items = tmp_url.split('/repos/') tool_shed_url = items[0] repo_path = items[1] tool_shed_url = common_util.remove_port_from_tool_shed_url(tool_shed_url) return '/'.join([tool_shed_url, 'repos', repo_path, changeset_revision])
def get_tool_panel_config_tool_path_install_dir(app, repository): """ Return shed-related tool panel config, the tool_path configured in it, and the relative path to the directory where the repository is installed. This method assumes all repository tools are defined in a single shed-related tool panel config. """ tool_shed = common_util.remove_port_from_tool_shed_url( str(repository.tool_shed)) relative_install_dir = '{}/repos/{}/{}/{}'.format( tool_shed, str(repository.owner), str(repository.name), str(repository.installed_changeset_revision)) # Get the relative tool installation paths from each of the shed tool configs. shed_config_dict = repository.get_shed_config_dict(app) shed_tool_conf = shed_config_dict['config_filename'] tool_path = shed_config_dict['tool_path'] return shed_tool_conf, tool_path, relative_install_dir