Opened 14 years ago

Last modified 14 years ago

#3097 new enhancement

Add preference to set/override environment variables

Reported by: kyngchaos Owned by: nobody
Priority: major: does not work as expected Milestone: Version 1.7.0
Component: GUI Version: Trunk
Keywords: shell environment Cc:
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no

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, ...

Change History (1)

comment:1 by kyngchaos, 14 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)
Note: See TracTickets for help on using tickets.