Hello,

Is there a builtin function that can set LD_LIBRARY_PATH or equivalents 
platform-independently? It would be nice use such a function in a setup script. 
The code below illustrates what I mean, although it's entirely untested.

import sys
import os
def setPath(loc):
    """Set LD_LIBRARY_PATH and equivalents platform-independently"""
    p = {"win": "PATH",
            "lin": "LD_LIBRARY_PATH",
            "solaris": "LD_LIBRARY_PATH",
            "aix": "LIBPATH",
            "darwin":
 "DYLD_LIBRARY_PATH",
            "hpux": "SHLIB_PATH"}
    pf = sys.platform()
    sep = ";" if pf.startswith("win") else ":"
    try:
        os.environ[p[pf]] += (sep + loc)
    except KeyError:
        print "Platform %s not supported" % pf


 
Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a 
fresh water system, and public health, what have the Romans ever done for
 us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to