[Distutils] working-env.py

Phillip J. Eby pje at telecommunity.com
Sat Mar 11 23:40:10 CET 2006


At 03:22 PM 3/11/2006 -0600, Ian Bicking wrote:
>    #!/usr/bin/python -S
>    import sys, os
>    join, dirname = os.path.join, os.path.dirname
>    lib_dir = join(dirname(dirname(__file__)), 'lib', 'python%s.%s' %
>tuple(sys.version_info[:2]))
>    sys.path.insert(0, lib_dir)
>    import site
>    ... normal stuff ...

FYI, I plan to write a proposal next week for script path freezing, along 
the lines of what I talked with you and Jim Fulton at PyCon about.  The 
basic idea is that there'll be a '.pylibs' file alongside the script (e.g. 
'foo.pylibs' alongside a 'foo' script) that lists what should be at the 
front of sys.path.

There are still some details to be worked out, but the basic idea is that 
this would happen in such a way as to ensure that precisely the libraries 
needed by the script would be first on sys.path, so that it would "inherit" 
default versions from the environment for plugins or dynamic dependencies only.



More information about the Distutils-SIG mailing list