1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/803730aa8abf/ Changeset: 803730aa8abf User: davebgx Date: 2014-04-01 19:08:02 Summary: Pass shell=True to subprocess.Popen, which eliminates the need to escape double quotes and prepend /bin/sh -c to a tool dependency shell command. Affected #: 1 file diff -r 7755367b06981f35fbc6911935513439c7e5445f -r 803730aa8abfa842bfceb8d4563b906d3bdf42d1 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 @@ -300,13 +300,13 @@ retain control over the process. This method is named "complex" because it uses queues and threads to execute a command while capturing and displaying the output. """ - wrapped_command = shlex.split( '/bin/sh -c "%s"' % str( command ) ) # Launch the command as subprocess. A bufsize of 1 means line buffered. - process_handle = subprocess.Popen( wrapped_command, + process_handle = subprocess.Popen( str( command ), stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1, close_fds=False, + shell=True, cwd=state.env[ 'lcwd' ] ) pid = process_handle.pid # Launch the asynchronous readers of the process' stdout and stderr. @@ -616,10 +616,10 @@ with lcd( current_dir ): with settings( warn_only=True ): for tarball_name in tarball_names: - # Use raw strings so that python won't automatically unescape the \", needed because handle_command wraps - # the provided command in /bin/sh -c "<command>". + # Use raw strings so that python won't automatically unescape the quotes before passing the command + # to subprocess.Popen. 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)\"''' % \ + 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 ) @@ -675,10 +675,10 @@ # gem file from rubygems.org with or without version number if 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>". + # Use raw strings so that python won't automatically unescape the quotes before passing the command + # to subprocess.Popen. cmd = r'''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME; - gem install %s --version \"=%s\"''' % ( gem, gem_version) + 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; @@ -835,8 +835,8 @@ return_code = handle_command( app, tool_dependency, install_dir, full_setup_command ) if return_code: return tool_dependency - # Use raw strings so that python won't automatically unescape the \", needed because handle_command wraps - # the provided command in /bin/sh -c "<command>". + # Use raw strings so that python won't automatically unescape the quotes before passing the command + # to subprocess.Popen. 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: 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.