prepend PWD to PYTHONPATH

This commit is contained in:
Michael Davidsaver
2014-06-16 16:22:24 -04:00
parent d10ecd5d69
commit 56ea9de16e
2 changed files with 15 additions and 2 deletions

View File

@ -371,7 +371,19 @@ static void setupPyPath(void)
Py_XDECREF(mod);
if(path) {
PyObject *cur;
char cwd[PATH_MAX];
insertDefaultPath(path);
/* prepend current directory */
if(getcwd(cwd, sizeof(cwd)-1)) {
cwd[sizeof(cwd)-1] = '\0';
cur = PyString_FromString(cwd);
if(cur)
PyList_Insert(path, 0, cur);
Py_XDECREF(cur);
}
}
Py_XDECREF(path);
}

View File

@ -27,9 +27,10 @@ PYTHONPATH
The interpreter search path is automatically prefixed with the following additional paths:
* ``$(EPICS_BASE)/python<PY_VER>/$(EPICS_ARCH)``
* ``$(PYDEV_BASE)/python<PY_VER>/$(EPICS_ARCH)``
* ``${PWD}``
* ``$(TOP)/python<PY_VER>/$(EPICS_ARCH)``
* ``$(PYDEV_BASE)/python<PY_VER>/$(EPICS_ARCH)``
* ``$(EPICS_BASE)/python<PY_VER>/$(EPICS_ARCH)``
The environment variables ``EPICS_BASE``, ``PYDEV_BASE``, ``TOP``, and ``EPICS_ARCH``
will be used if set. Compile time defaults are selected for