Bug report #14143

getRequiredPackages in RUtils.py does not respect commented out lines

Added by Tom Baginski almost 9 years ago. Updated over 7 years ago.

Status:Closed
Priority:Low
Assignee:Victor Olaya
Category:Processing/Core
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:22145

Description

The function getRequirePackages in python/plugins/processing/algs/r/RUtils.py includes packages that are commented out.

The regular expression in the function searches for the string 'library' without respect for lines that are commented out with a '#'. The returned list of packages includes package names for lines that are commented out in the .rsx file. As a result, getImortCommands in python/plugins/processing/algs/r/RAlgorithm.py adds lines to the generated r script that tries to install packages that are not needed by the script.

As an example:

in an .rsx file:

#library(network)

adds:

tryCatch(find.package("network"), error=function(e) install.packages("network", dependencies=TRUE))

to processing_script.r even though the library is not needed or used.

I can work around this in my code by removing the commented out library line from my .rsx file. However, the regular expression should be modified to respect comments

Associated revisions

Revision f0cb706a
Added by Alexander Bruy almost 9 years ago

[processing] exclude commented R libraries when generating dependencies list (fix #14143)

History

#1 Updated by Alexander Bruy almost 9 years ago

  • Status changed from Open to Closed

#2 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No

#3 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No

#4 Updated by Giovanni Manghi over 7 years ago

Some providers are being removed from QGIS/Processing (will be available as plugin) and so are their categories in the bug tracker. To not leave them orphaned of a category they are being reassigned to processing/core.

#5 Updated by Giovanni Manghi over 7 years ago

  • Category changed from 124 to Processing/Core

Also available in: Atom PDF