Feature request #3097

Add preference to set/override environment variables

Added by William Kyngesburye almost 9 years ago. Updated over 6 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:GUI
Pull Request or Patch supplied:Yes Resolution:
Easy fix?:No Copied to github as #:13157

Description

This is mainly for OS X, maybe Windows is similar? Could still be useful on *nix.

On OS X, applications don't get any of the shell environment. It's just the way OS X works (generally no need for it from a purely OS X perspective). Applications still know about and can use environment variables, and there is a hidden and little-documented (if at all) method to set them for applications, but it is a hidden plist and really needs 3rd party software to safely and easily edit.

Some (many?) Qgis plugins use unix-like tools, like GDAL, and need paths and configuration from the environment. Rather than having every developer remember to add a configuration menu to their plugins when environment variables are needed, I think Qgis needs a preference section to set environment variables that all plugins can use.

Maintaining a list of arbitrary user-added variables would be ideal for future flexibility (who knows what a plugin will need). But if security is a concern, at least have a fixed list of common variables, like PATH, java-related, GDAL_SKIP, ...

Associated revisions

Revision 99edf1de
Added by Giuseppe Sucameli almost 8 years ago

[BACKPORT] find python on OSX (partially fix #3097)
don't overwrite PATH env var, but append to it.

Revision f093f517
Added by Giuseppe Sucameli almost 8 years ago

[BACKPORT] find python on OSX (partially fix #3097)
don't overwrite PATH env var, but append to it.

History

#1 Updated by William Kyngesburye almost 9 years ago

Specific example: GdalTools. It does have a path configuration option, for where the GDAL programs are, but it's not enough. There are 2 problems:

  • can't find python - the env PATH is empty, except for the configured path, so GDAL python programs can't find python to be able to run. This one is solvable by adding /usr/bin to the configured GDAL path, but a user shouldn't have to do this, and multiple paths in the setting is unintuitive considering that the choose button returns only a single path.
  • can't find GDAL python extensions (#3170) - in a normal installation, this works, as GDAL python is in the standard user site-packages folder which python knows about. But when GDAL is bundled in the Qgis standalone application, python does not have the Qgis python folder in its sys.path, and any external python scripts, like many GDAL programs, can't import gdal. (external python scripts don't use the Qgis python interpreter)

#2 Updated by Giuseppe Sucameli almost 8 years ago

  • Assignee deleted (nobody -)
  • Pull Request or Patch supplied set to No

William Kyngesburye wrote:

  • can't find python - the env PATH is empty, except for the configured path, so GDAL python programs can't find python to be able to run. This one is solvable by adding /usr/bin to the configured GDAL path, but a user shouldn't have to do this, and multiple paths in the setting is unintuitive considering that the choose button returns only a single path.

This part should be fixed in commit 99edf1de05231f422c9f2f6e2110709557f62ea2. I know it's not enough, but I'm working to fix it at all.

#3 Updated by Giovanni Manghi almost 8 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

#4 Updated by Giovanni Manghi over 7 years ago

  • Target version changed from Version 1.7.4 to Version 2.0.0

#5 Updated by Pirmin Kalberer almost 7 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

#6 Updated by Larry Shaffer over 6 years ago

  • Status changed from Open to Feedback
  • Target version changed from Future Release - Nice to have to Version 2.0.0
  • Pull Request or Patch supplied changed from No to Yes

Hi,

I've implemented a version of this in the following pull request:

https://github.com/qgis/Quantum-GIS/pull/372

Please test.

#7 Updated by Matthias Kuhn over 6 years ago

  • Status changed from Feedback to Closed

Resolved in 5cd7dc5

Please reopen if there are still problems.

Also available in: Atom PDF