1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d0c56b58064b/ Changeset: d0c56b58064b User: jmchilton Date: 2013-12-13 22:43:26 Summary: Use null object pattern to simplify logic related to no dependency manager being set. Fixes bug introduced in 4241eff related to dependency_manager being None if tool_dependency_dir is not set. Affected #: 4 files diff -r 97f810044c531393a56cb84898ab5e7b759ee3e2 -r d0c56b58064bd73bd6ca408796453abb0f5404c2 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -688,10 +688,7 @@ if self.command_line and self.command_line.startswith( 'python' ): self.galaxy_lib_dir = os.path.abspath( "lib" ) # cwd = galaxy root # Shell fragment to inject dependencies - if self.app.config.use_tool_dependencies: - self.dependency_shell_commands = self.tool.build_dependency_shell_commands() - else: - self.dependency_shell_commands = None + self.dependency_shell_commands = self.tool.build_dependency_shell_commands() # We need command_line persisted to the db in order for Galaxy to re-queue the job # if the server was stopped and restarted before the job finished job.command_line = self.command_line @@ -1435,10 +1432,7 @@ if self.command_line and self.command_line.startswith( 'python' ): self.galaxy_lib_dir = os.path.abspath( "lib" ) # cwd = galaxy root # Shell fragment to inject dependencies - if self.app.config.use_tool_dependencies: - self.dependency_shell_commands = self.tool.build_dependency_shell_commands() - else: - self.dependency_shell_commands = None + self.dependency_shell_commands = self.tool.build_dependency_shell_commands() # We need command_line persisted to the db in order for Galaxy to re-queue the job # if the server was stopped and restarted before the job finished task.command_line = self.command_line diff -r 97f810044c531393a56cb84898ab5e7b759ee3e2 -r d0c56b58064bd73bd6ca408796453abb0f5404c2 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -40,7 +40,7 @@ from galaxy.tools.actions import DefaultToolAction from galaxy.tools.actions.data_source import DataSourceToolAction from galaxy.tools.actions.data_manager import DataManagerToolAction -from galaxy.tools.deps import DependencyManager, INDETERMINATE_DEPENDENCY +from galaxy.tools.deps import build_dependency_manager from galaxy.tools.deps.requirements import parse_requirements_from_xml from galaxy.tools.parameters import check_param, params_from_strings, params_to_strings from galaxy.tools.parameters.basic import (BaseURLToolParameter, @@ -700,14 +700,7 @@ return stored.latest_workflow def init_dependency_manager( self ): - if self.app.config.use_tool_dependencies: - dependency_manager_kwds = { - 'default_base_path': self.app.config.tool_dependency_dir, - 'conf_file': self.app.config.dependency_resolvers_config_file, - } - self.dependency_manager = DependencyManager( **dependency_manager_kwds ) - else: - self.dependency_manager = None + self.dependency_manager = build_dependency_manager( self.app.config ) @property def sa_session( self ): diff -r 97f810044c531393a56cb84898ab5e7b759ee3e2 -r d0c56b58064bd73bd6ca408796453abb0f5404c2 lib/galaxy/tools/deps/__init__.py --- a/lib/galaxy/tools/deps/__init__.py +++ b/lib/galaxy/tools/deps/__init__.py @@ -15,6 +15,31 @@ from galaxy.util.submodules import submodules +def build_dependency_manager( config ): + if config.use_tool_dependencies: + dependency_manager_kwds = { + 'default_base_path': config.tool_dependency_dir, + 'conf_file': config.dependency_resolvers_config_file, + } + dependency_manager = DependencyManager( **dependency_manager_kwds ) + else: + dependency_manager = NullDependencyManager() + + return dependency_manager + + +class NullDependencyManager( object ): + + def uses_tool_shed_dependencies(self): + return False + + def dependency_shell_commands( self, requirements, **kwds ): + return [] + + def find_dep( self, name, version=None, type='package', **kwds ): + return INDETERMINATE_DEPENDENCY + + class DependencyManager( object ): """ A DependencyManager attempts to resolve named and versioned dependencies by diff -r 97f810044c531393a56cb84898ab5e7b759ee3e2 -r d0c56b58064bd73bd6ca408796453abb0f5404c2 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 @@ -462,7 +462,7 @@ if tool_dependency.can_install: # The database record is currently in a state that allows us to install the package on the file system. try: - dependencies_ignored = app.toolbox.dependency_manager and not app.toolbox.dependency_manager.uses_tool_shed_dependencies() + dependencies_ignored = not app.toolbox.dependency_manager.uses_tool_shed_dependencies() if dependencies_ignored: log.debug( "Skipping package %s because tool shed dependency resolver not enabled." % str( package_name ) ) # Tool dependency resolves have been configured and they do not include the tool shed. Do not install package. 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.