1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/465b390ffeed/ Changeset: 465b390ffeed User: davebgx Date: 2014-06-03 22:09:03 Summary: Merge in set_environment bugfix from stable. Affected #: 6 files diff -r beef22110c25635ed18a3c24f9d94442a4a4cc9c -r 465b390ffeeda37663b92de91c1fa50a46743292 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -465,11 +465,11 @@ tool_dependencies_config = hg_util.get_config_from_disk( rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME, tool_shed_repository.repo_path( trans.app ) ) installed_tool_dependencies = \ - common_install_util.install_specified_packages( app=trans.app, - tool_shed_repository=tool_shed_repository, - tool_dependencies_config=tool_dependencies_config, - tool_dependencies=tool_dependencies, - from_tool_migration_manager=False ) + common_install_util.install_specified_tool_dependencies( app=trans.app, + tool_shed_repository=tool_shed_repository, + tool_dependencies_config=tool_dependencies_config, + tool_dependencies=tool_dependencies, + from_tool_migration_manager=False ) for installed_tool_dependency in installed_tool_dependencies: if installed_tool_dependency.status == trans.app.install_model.ToolDependency.installation_status.ERROR: text = util.unicodify( installed_tool_dependency.error_message ) diff -r beef22110c25635ed18a3c24f9d94442a4a4cc9c -r 465b390ffeeda37663b92de91c1fa50a46743292 lib/tool_shed/galaxy_install/install_manager.py --- a/lib/tool_shed/galaxy_install/install_manager.py +++ b/lib/tool_shed/galaxy_install/install_manager.py @@ -187,7 +187,6 @@ a partial or full list of ToolDependency records associated with the tool_shed_repository. """ tag_manager = TagManager() - sa_session = app.install_model.context # The value of package_name should match the value of the "package" type in the tool config's # <requirements> tag set, but it's not required. package_name = elem.get( 'name', None ) diff -r beef22110c25635ed18a3c24f9d94442a4a4cc9c -r 465b390ffeeda37663b92de91c1fa50a46743292 lib/tool_shed/galaxy_install/tool_dependencies/recipe/recipe_manager.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/recipe_manager.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/recipe_manager.py @@ -97,7 +97,8 @@ return tool_dependency, proceed_with_install, action_elem_tuples def load_tag_handlers( self ): - tag_handlers = dict( install=tag_handler.Install(), + tag_handlers = dict( environment_variable=tag_handler.SetEnvironment(), + install=tag_handler.Install(), package=tag_handler.Package(), readme=tag_handler.ReadMe(), repository=tag_handler.Repository(), diff -r beef22110c25635ed18a3c24f9d94442a4a4cc9c -r 465b390ffeeda37663b92de91c1fa50a46743292 lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py @@ -446,9 +446,12 @@ def process_tag_set( self, app, tool_shed_repository, tool_dependency, package_elem, package_name, package_version, from_tool_migration_manager=False, tool_dependency_db_records=None ): + # We need to handle two tag sets for package_elem here, this: # <set_environment version="1.0"> # <environment_variable name="R_SCRIPT_PATH"action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable> # </set_environment> + # or this: + # <environment_variable name="R_SCRIPT_PATH"action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable> action_elem_tuples = [] proceed_with_install = False if tool_dependency_db_records is None: @@ -479,6 +482,9 @@ <set_environment version="1.0"><environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable></set_environment> + + This method must also handle the sub-element tag:: + <environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable> """ # TODO: Add support for a repository dependency definition within this tool dependency type's tag set. This should look something like # the following. See the implementation of support for this in the tool dependency package type's method above. @@ -495,11 +501,19 @@ tool_dependencies = [] env_var_version = elem.get( 'version', '1.0' ) tool_shed_repository_install_dir = os.path.abspath( tool_shed_repository.repo_files_directory( app ) ) - for env_var_elem in elem: - # Althoug we're in a loop here, this method will always return only a single ToolDependency or None. + if elem.tag == 'environment_variable': + # <environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable> + elems = [ elem ] + else: + # <set_environment version="1.0"> + # <environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable> + # </set_environment> + elems = [ env_var_elem for env_var_elem in elem ] + for env_var_elem in elems: env_var_name = env_var_elem.get( 'name', None ) - # The value of env_var_name must match the text value of at least 1 <requirement> tag in the tool config's <requirements> tag set whose - # "type" attribute is "set_environment" (e.g., <requirement type="set_environment">R_SCRIPT_PATH</requirement>). + # The value of env_var_name must match the text value of at least 1 <requirement> tag in the + # tool config's <requirements> tag set whose "type" attribute is "set_environment" (e.g., + # <requirement type="set_environment">R_SCRIPT_PATH</requirement>). env_var_action = env_var_elem.get( 'action', None ) if env_var_name and env_var_action: # Tool dependencies of type "set_environmnet" always have the version attribute set to None. diff -r beef22110c25635ed18a3c24f9d94442a4a4cc9c -r 465b390ffeeda37663b92de91c1fa50a46743292 lib/tool_shed/galaxy_install/tool_migration_manager.py --- a/lib/tool_shed/galaxy_install/tool_migration_manager.py +++ b/lib/tool_shed/galaxy_install/tool_migration_manager.py @@ -447,11 +447,11 @@ # Get the tool_dependencies.xml file from disk. tool_dependencies_config = hg_util.get_config_from_disk( 'tool_dependencies.xml', repo_install_dir ) installed_tool_dependencies = \ - common_install_util.install_specified_packages( app=self.app, - tool_shed_repository=tool_shed_repository, - tool_dependencies_config=tool_dependencies_config, - tool_dependencies=tool_dependencies, - from_tool_migration_manager=True ) + common_install_util.install_specified_tool_dependencies( app=self.app, + tool_shed_repository=tool_shed_repository, + tool_dependencies_config=tool_dependencies_config, + tool_dependencies=tool_dependencies, + from_tool_migration_manager=True ) for installed_tool_dependency in installed_tool_dependencies: if installed_tool_dependency.status == self.app.install_model.ToolDependency.installation_status.ERROR: print '\nThe ToolMigrationManager returned the following error while installing tool dependency ', installed_tool_dependency.name, ':' diff -r beef22110c25635ed18a3c24f9d94442a4a4cc9c -r 465b390ffeeda37663b92de91c1fa50a46743292 lib/tool_shed/util/common_install_util.py --- a/lib/tool_shed/util/common_install_util.py +++ b/lib/tool_shed/util/common_install_util.py @@ -18,6 +18,7 @@ from tool_shed.util import xml_util from tool_shed.galaxy_install.install_manager import InstallManager +from tool_shed.galaxy_install.tool_dependencies.recipe.recipe_manager import StepManager from tool_shed.galaxy_install.tool_dependencies.recipe.recipe_manager import TagManager log = logging.getLogger( __name__ ) @@ -483,7 +484,8 @@ all_required_repo_info_dict[ 'all_repo_info_dicts' ] = all_repo_info_dicts return all_required_repo_info_dict -def install_specified_packages( app, tool_shed_repository, tool_dependencies_config, tool_dependencies, from_tool_migration_manager=False ): +def install_specified_tool_dependencies( app, tool_shed_repository, tool_dependencies_config, tool_dependencies, + from_tool_migration_manager=False ): """ 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 @@ -502,28 +504,46 @@ log.debug( "The received tool_dependencies.xml file is likely invalid: %s" % str( error_message ) ) return installed_packages root = tree.getroot() + elems = [] for elem in root: - package_name = elem.get( 'name', None ) - package_version = elem.get( 'version', None ) - if package_name and package_version: - # elem is a package tag set. - attr_tup = ( package_name, package_version, 'package' ) + if elem.tag == 'set_environment': + version = elem.get( 'version', '1.0' ) + if version != '1.0': + raise Exception( 'The <set_environment> tag must have a version attribute with value 1.0' ) + for sub_elem in elem: + elems.append( sub_elem ) + else: + elems.append( elem ) + for elem in elems: + name = elem.get( 'name', None ) + version = elem.get( 'version', None ) + type = elem.get( 'type', None ) + if type is None: + if elem.tag in [ 'environment_variable', 'set_environment' ]: + type = 'set_environment' + else: + type = 'package' + if ( name and type == 'set_environment' ) or ( name and version ): + # elem is a package set_environment tag set. + attr_tup = ( name, version, type ) try: index = attr_tups_of_dependencies_for_install.index( attr_tup ) except Exception, e: index = None if index is not None: tool_dependency = tool_dependencies[ index ] + # If the tool_dependency.type is 'set_environment', then the call to process_tag_set() will + # handle everything - no additional installation is necessary. tool_dependency, proceed_with_install, action_elem_tuples = \ tag_manager.process_tag_set( app, tool_shed_repository, tool_dependency, elem, - package_name, - package_version, + name, + version, from_tool_migration_manager=from_tool_migration_manager, tool_dependency_db_records=tool_dependencies ) - if proceed_with_install: + if ( tool_dependency.type == 'package' and proceed_with_install ): try: tool_dependency = install_manager.install_package( app, elem, @@ -531,8 +551,8 @@ tool_dependencies=tool_dependencies, from_tool_migration_manager=from_tool_migration_manager ) except Exception, e: - error_message = "Error installing tool dependency package %s version %s: %s" % \ - ( str( package_name ), str( package_version ), str( e ) ) + error_message = "Error installing tool dependency %s version %s: %s" % \ + ( str( name ), str( version ), str( e ) ) log.exception( error_message ) if tool_dependency: # Since there was an installation error, update the tool dependency status to Error. The Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.