Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
Under Fedora/CentOS/RHEL, this is in the repos as environment-modules On Wed, Aug 3, 2011 at 6:31 PM, Shankar Viswanathan <shankar.viswan at gmail.com> wrote: > On Wed, Aug 3, 2011 at 10:28 AM, Jerry Feldman <gaf at blu.org> wrote: >> A coworker of mine has a Python script set up as: >> #! $PATH_TO_PYTHON/python >> ... python code >> >> It is not unusual to have commands like this. Mailman does this with >> several of its commands. The issue here is that he needs to use an >> environment variable to call the python interpreter. We certainly can do >> it a messy way: >> #! /bin/bash >> $PATH_TO_PYTHON/python foo.py >> >> But this would require a wrapper script. >> >> Or he can use an explicit path to the python interpreter. >> #! /usr/bin/python >> >> The problem here is that the version of python he uses MUST be >> encapsulated in our company's product. >> #! /mnt/fubar/versionxyz/bin/python >> >> But this will possibly differ with each release of our company's product >> since we maintain a number of releases here. ?Some other solutions is to >> set up symlinks in the local directory. >> >> Any ideas on how to get the loader to expand the environment variable >> after the #!?? > > At work, we use the 'modules' system to solve this problem: > http://modules.sourceforge.net/ > > We put the list of modules and versions needed for a project in a > .bashrc file that we customize for each project/customer. You just > have to load the specific .bashrc file for your project, which can > also contain other environment variables in addition to the modules. > > The python script can then simply have: > #!/usr/bin/env python > <python code> > > This has proved very flexible and versatile system for us when dealing > with multiple tools, both internal and those from external vendors. > You just have to spend some time initially creating the modulefile for > each tool. > > Hope this helps, > Shankar > _______________________________________________ > Discuss mailing list > Discuss at blu.org > http://lists.blu.org/mailman/listinfo/discuss > -- John Abreau / Executive Director, Boston Linux & Unix GnuPG KeyID: 0xD5C7B5D9 / Email: abreauj at gmail.com GnuPG FP: 72 FB 39 4F 3C 3B D6 5B E0 C8 5A 6E F1 2C BE 99
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |