1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/108cda898646/ changeset: 108cda898646 user: greg date: 2012-09-07 20:49:46 summary: Enhancements to tool dependency installation when installing with a tool shed repository: multiple environment variables can now be set and a new "make_directory" tag is supported. affected #: 3 files diff -r 1475240809a7e9b996aa7b9026b33e20ea9209bd -r 108cda8986460298279279fca9ae40661a8e6174 lib/galaxy/tool_shed/tool_dependencies/common_util.py --- a/lib/galaxy/tool_shed/tool_dependencies/common_util.py +++ b/lib/galaxy/tool_shed/tool_dependencies/common_util.py @@ -17,6 +17,9 @@ return tarfile.is_tarfile( file_path ) def iszip( file_path ): return check_zip( file_path ) +def make_directory( full_path ): + if not os.path.exists( full_path ): + os.makedirs( full_path ) def move_directory_files( current_dir, source_dir, destination_dir ): source_directory = os.path.abspath( os.path.join( current_dir, source_dir ) ) destination_directory = os.path.join( destination_dir ) diff -r 1475240809a7e9b996aa7b9026b33e20ea9209bd -r 108cda8986460298279279fca9ae40661a8e6174 lib/galaxy/tool_shed/tool_dependencies/fabric_util.py --- a/lib/galaxy/tool_shed/tool_dependencies/fabric_util.py +++ b/lib/galaxy/tool_shed/tool_dependencies/fabric_util.py @@ -88,7 +88,9 @@ for action_tup in actions[ 1: ]: action_type, action_dict = action_tup current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) - if action_type == 'move_directory_files': + if action_type == 'make_directory': + common_util.make_directory( full_path=action_dict[ 'full_path' ] ) + elif action_type == 'move_directory_files': common_util.move_directory_files( current_dir=current_dir, source_dir=os.path.join( action_dict[ 'source_directory' ] ), destination_dir=os.path.join( action_dict[ 'destination_directory' ] ) ) @@ -98,29 +100,36 @@ destination_dir=os.path.join( action_dict[ 'destination' ] ) ) elif action_type == 'set_environment': # Currently the only action supported in this category is "environment_variable". - env_var_dict = action_dict[ 'environment_variable' ] - env_var_name = env_var_dict[ 'name' ] - env_var_action = env_var_dict[ 'action' ] - env_var_value = env_var_dict[ 'value' ] - if env_var_action == 'prepend_to': - changed_value = '%s:$%s' % ( env_var_value, env_var_name ) - elif env_var_action == 'set_to': - changed_value = '%s' % env_var_value - elif env_var_action == 'append_to': - changed_value = '$%s:%s' % ( env_var_name, env_var_value ) - cmd = "echo '%s=%s; export %s' > %s/env.sh;chmod +x %s/env.sh" % ( env_var_name, - changed_value, - env_var_name, - install_dir, - install_dir ) - output = local( cmd, capture=True ) - log_results( cmd, output, os.path.join( install_dir, INSTALLATION_LOG ) ) - if output.return_code: - tool_dependency.status = app.model.ToolDependency.installation_status.ERROR - tool_dependency.error_message = str( output.stderr ) - sa_session.add( tool_dependency ) - sa_session.flush() - return + env_var_dicts = action_dict[ 'environment_variable' ] + for env_var_dict in env_var_dicts: + env_var_name = env_var_dict[ 'name' ] + env_var_action = env_var_dict[ 'action' ] + env_var_value = env_var_dict[ 'value' ] + if env_var_action == 'prepend_to': + changed_value = '%s:$%s' % ( env_var_value, env_var_name ) + elif env_var_action == 'set_to': + changed_value = '%s' % env_var_value + elif env_var_action == 'append_to': + changed_value = '$%s:%s' % ( env_var_name, env_var_value ) + env_shell_file_path = '%s/env.sh' % install_dir + if os.path.exists( env_shell_file_path ): + write_action = '>>' + else: + write_action = '>' + cmd = "echo '%s=%s; export %s' %s %s;chmod +x %s" % ( env_var_name, + changed_value, + env_var_name, + write_action, + env_shell_file_path, + env_shell_file_path ) + output = local( cmd, capture=True ) + log_results( cmd, output, os.path.join( install_dir, INSTALLATION_LOG ) ) + if output.return_code: + tool_dependency.status = app.model.ToolDependency.installation_status.ERROR + tool_dependency.error_message = str( output.stderr ) + sa_session.add( tool_dependency ) + sa_session.flush() + return elif action_type == 'shell_command': action = action_dict[ 'command' ] with settings( warn_only=True ): diff -r 1475240809a7e9b996aa7b9026b33e20ea9209bd -r 108cda8986460298279279fca9ae40661a8e6174 lib/galaxy/tool_shed/tool_dependencies/install_util.py --- a/lib/galaxy/tool_shed/tool_dependencies/install_util.py +++ b/lib/galaxy/tool_shed/tool_dependencies/install_util.py @@ -113,6 +113,12 @@ action_dict[ 'url' ] = action_elem.text else: continue + elif action_type == 'make_directory': + # <action type="make_directory">$INSTALL_DIR/lib/python</action> + if action_elem.text: + action_dict[ 'full_path' ] = action_elem.text.replace( '$INSTALL_DIR', install_dir ) + else: + continue elif action_type in [ 'move_directory_files', 'move_file' ]: # <action type="move_file"> # <source>misc/some_file</source> @@ -128,15 +134,21 @@ action_dict[ move_elem.tag ] = move_elem_text elif action_type == 'set_environment': # <action type="set_environment"> + # <environment_variable name="PYTHONPATH" action="append_to">$INSTALL_DIR/lib/python</environment_variable> # <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable> # </action> + env_var_dicts = [] for env_elem in action_elem: if env_elem.tag == 'environment_variable': env_var_name = env_elem.get( 'name', 'PATH' ) env_var_action = env_elem.get( 'action', 'prepend_to' ) env_var_text = env_elem.text.replace( '$INSTALL_DIR', install_dir ) if env_var_text: - action_dict[ env_elem.tag ] = dict( name=env_var_name, action=env_var_action, value=env_var_text ) + env_var_dicts.append( dict( name=env_var_name, action=env_var_action, value=env_var_text ) ) + if env_var_dicts: + action_dict[ env_elem.tag ] = env_var_dicts + else: + continue else: continue actions.append( ( action_type, action_dict ) ) 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.