This reverts commit 79c6075b56
.
# Conflicts:
# docs/markdown/snippets/devenv.md
# mesonbuild/modules/python.py
# test cases/unit/91 devenv/test-devenv.py
PYTHONPATH cannot be reliably determined. The standard use case for
installing python modules with Meson is mixed pure sources (at least
`__init__.py`) and compiled extension_modules or configured files.
Unfortunately that doesn't actually work because python will not load
the same package hierarchy from two different directories, one a source
directory and one a (mandatory) out of tree build directory.
(It kind of can, but you need to do what this test case accidentally
stumbled upon, which is namespace packages. Namespace packages are a
very specific use case and you are NOT SUPPOSED to use them outside that
use case, so people are not going to use them just to circumvent Meson
devenv stuff as that would have negative install-time effects.)
Adding PYTHONPATH anyway will just lead to documentation commitments
which we cannot actually uphold, and confusing issues at time of use
because some imports *will* work... and some will *not*. The end result
will be a half-created tree of modules which just doesn't work together
at all, but because it partially works, users attempting to debug it
will spend time wondering why parts of it do import.
For any case where the automatic devenv would work correctly, it will
also work correctly to use `meson.add_devenv()` a single time, which is
very easy to manually get correct and doesn't provide any significant
value to automate.
In the long run, an uninstalled python package environment will require
"editable installs" support.
pull/10041/head
parent
7c20890a05
commit
68b8fbcf6d
8 changed files with 7 additions and 94 deletions
@ -1 +0,0 @@ |
||||
hello = 'world' |
@ -1,5 +0,0 @@ |
||||
py.extension_module('mod2', 'mod2.c', |
||||
dependencies: py.dependency(), |
||||
subdir: 'mymod2', |
||||
install: true |
||||
) |
@ -1,14 +0,0 @@ |
||||
#include <Python.h> |
||||
#include <string.h> |
||||
|
||||
static PyObject *hello(PyObject *self, PyObject *args) { |
||||
return PyLong_FromLong(42); |
||||
} |
||||
|
||||
static PyMethodDef methods[] = {{"hello", hello, METH_NOARGS, "Hello World"}, |
||||
{NULL, NULL, 0, NULL}}; |
||||
|
||||
static struct PyModuleDef mod = {PyModuleDef_HEAD_INIT, "test", NULL, -1, |
||||
methods}; |
||||
|
||||
PyMODINIT_FUNC PyInit_mod2(void) { return PyModule_Create(&mod); } |
Loading…
Reference in new issue