--- Python-2.6.4/Python/pythonrun.c Sat Apr 4 07:19:56 2009 +++ Python-2.6.4/Python/pythonrun.c Wed May 18 11:13:05 2011 @@ -55,6 +55,7 @@ /* Forward */ static void initmain(void); static void initsite(void); +static void initvendor(void); static PyObject *run_mod(mod_ty, const char *, PyObject *, PyObject *, PyCompilerFlags *, PyArena *); static PyObject *run_pyc_file(FILE *, const char *, PyObject *, PyObject *, @@ -245,6 +246,7 @@ initmain(); /* Module __main__ */ if (!Py_NoSiteFlag) initsite(); /* Module site */ + initvendor(); /* auto-thread-state API, if available */ #ifdef WITH_THREAD @@ -594,6 +596,7 @@ initmain(); if (!Py_NoSiteFlag) initsite(); + initvendor(); } if (!PyErr_Occurred()) @@ -716,6 +719,25 @@ Py_DECREF(m); } } + +/* Append a vendor-packages directory to the module path */ + +static void +initvendor(void) +{ + PyObject *sys_path, *vps; + + sys_path = PySys_GetObject("path"); + + vps = PyString_FromFormat( + "%s/lib/python%d.%d/vendor-packages", Py_GetPrefix(), + PY_MAJOR_VERSION, PY_MINOR_VERSION); + + if (sys_path && vps) { + PyList_Append(sys_path, vps); + Py_DECREF(vps); + } +} /* Parse input from a file and execute it */