commit/galaxy-central: davebgx: Pass raw strings to handle_command so that python won't automatically unescape the double quotes being sent on to subprocess.Popen.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d2ba52e5ec11/ Changeset: d2ba52e5ec11 User: davebgx Date: 2014-03-06 22:03:49 Summary: Pass raw strings to handle_command so that python won't automatically unescape the double quotes being sent on to subprocess.Popen. Affected #: 1 file diff -r 03f935bb636e0f4fa63782ce5d6a551ac508144a -r d2ba52e5ec11909a058c698d625aa139aa3c78d4 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -604,7 +604,7 @@ return tool_dependency else: install_environment.add_env_shell_file_paths( env_shell_file_paths ) - log.debug( 'Handling setup_r_environment for tool dependency %s with install_environment.env_shell_file_paths:\n%s"' % \ + log.debug( 'Handling setup_r_environment for tool dependency %s with install_environment.env_shell_file_paths:\n%s' % \ ( str( tool_dependency.name ), str( install_environment.env_shell_file_paths ) ) ) tarball_names = [] for url in action_dict[ 'r_packages' ]: @@ -616,8 +616,10 @@ with lcd( current_dir ): with settings( warn_only=True ): for tarball_name in tarball_names: - cmd = '''PATH=$PATH:$R_HOME/bin; export PATH; R_LIBS=$INSTALL_DIR; export R_LIBS; - Rscript -e \\"install.packages(c('%s'),lib='$INSTALL_DIR', repos=NULL, dependencies=FALSE)\\"''' % \ + # Use raw strings so that python won't automatically unescape the \", needed because handle_command wraps + # the provided command in /bin/sh -c "<command>". + cmd = r'''PATH=$PATH:$R_HOME/bin; export PATH; R_LIBS=$INSTALL_DIR; export R_LIBS; + Rscript -e \"install.packages(c('%s'),lib='$INSTALL_DIR', repos=NULL, dependencies=FALSE)\"''' % \ ( str( tarball_name ) ) cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) ) return_code = handle_command( app, tool_dependency, install_dir, cmd ) @@ -649,7 +651,7 @@ return tool_dependency else: install_environment.add_env_shell_file_paths( env_shell_file_paths ) - log.debug( 'Handling setup_ruby_environment for tool dependency %s with install_environment.env_shell_file_paths:\n%s"' % \ + log.debug( 'Handling setup_ruby_environment for tool dependency %s with install_environment.env_shell_file_paths:\n%s' % \ ( str( tool_dependency.name ), str( install_environment.env_shell_file_paths ) ) ) dir = os.path.curdir current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) @@ -672,9 +674,11 @@ else: # gem file from rubygems.org with or without version number if gem_version: - # version number was specified - cmd = '''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME; - gem install %s --version "=%s"''' % ( gem, gem_version) + # Specific ruby gem version was requested. + # Use raw strings so that python won't automatically unescape the \", needed because handle_command wraps + # the provided command in /bin/sh -c "<command>". + cmd = r'''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME; + gem install %s --version \"=%s\"''' % ( gem, gem_version) else: # no version number given cmd = '''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME; @@ -708,7 +712,7 @@ return tool_dependency else: install_environment.add_env_shell_file_paths( env_shell_file_paths ) - log.debug( 'Handling setup_perl_environment for tool dependency %s with install_environment.env_shell_file_paths:\n%s"' % \ + log.debug( 'Handling setup_perl_environment for tool dependency %s with install_environment.env_shell_file_paths:\n%s' % \ ( str( tool_dependency.name ), str( install_environment.env_shell_file_paths ) ) ) dir = os.path.curdir current_dir = os.path.abspath( os.path.join( work_dir, dir ) ) @@ -831,7 +835,9 @@ return_code = handle_command( app, tool_dependency, install_dir, full_setup_command ) if return_code: return tool_dependency - site_packages_command = "%s -c 'import os, sys; print os.path.join(sys.prefix, \"lib\", \"python\" + sys.version[:3], \"site-packages\")'" % os.path.join( venv_directory, "bin", "python" ) + # Use raw strings so that python won't automatically unescape the \", needed because handle_command wraps + # the provided command in /bin/sh -c "<command>". + site_packages_command = r"%s -c 'import os, sys; print os.path.join(sys.prefix, \"lib\", \"python\" + sys.version[:3], \"site-packages\")'" % os.path.join( venv_directory, "bin", "python" ) output = handle_command( app, tool_dependency, install_dir, site_packages_command, return_output=True ) if output.return_code: return tool_dependency 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.
participants (1)
-
commits-noreply@bitbucket.org