STAFInst is used to generate STAFEnv.sh file during installation. STAFEnv.sh, in turn, is used to set PATH, LD_LIBRARY_PATH, etc. properly to use staf without much trouble. Just adding "source <installation_path>/STAFEnv.sh" in .bashrc is needed.
However, if some Python development is going to be done, PYTHONPATH environment variable must be properly modified to be able to import PySTAF module. This isn't a very difficult thing to do, though it would be better to have it in STAFEnv.sh and don't having to worry about anything else.
This patch, just does this. It changes STAFInst file for Unix installations to generate a new STAFEnv.sh file that adds STAF installation directory to PYTHONPAH so that PySTAF module can be imported in python. The change doesn't make any test so this change in PYTHONPATH will be applied even if no python support has been compiled for staf. However, this should not make any harm at all in such a case.
By the way, category should be 'Lang::sh' and group 'STAFv3.2.5', but proper options don't seem to be available.
Patch for STAFInst file
Logged In: YES
user_id=1879218
Originator: YES
Hello,
I've noticed that the patch that I wrote doesn't work in some cases such as running a python script from staf cron service without using a new shell. To solve this, I've found that is much better to add a site-specific configuration file (http://docs.python.org/lib/module-site.html) that would take effect for all users regardless of their shell interpreter. Do you agree?
Best regards,
Javier
Logged In: YES
user_id=285070
Originator: NO
I don't understand. Could you provide more information? e.g. How did you "add a site-specific configuration file"?
Hello,
The main idea is that has a module called "site" that is imported automatically each time the interpreter is started unless "-S" option is used. This module is used to set configuration that isn't specific to any user, but that applies to the whole machine. One example of such a configuration is the path the the interpreter uses to locate modules (sys.path). When site module is imported on startup, it looks for ".pth" files to extend the path. For example, in my case, I created a file /usr/local/lib64/python2.4/site-packages/PySTAF.pth whose contents is just:
# Path for STAF module
<staf_lib_directory>
where <staf_lib_directory> is the directory where PySTAF module is located.
I think that this approach is much better than changing STAFEnv.sh since it applies changes to all users at once without having to change their .bashrc files. So probably patch that I submitted isn't interesting anymore and another one looking adding PySTAF.pth would be better.
Best regards,
Javier