On Mon, Nov 8, 2021 at 9:58 AM Simon Glass <sjg@xxxxxxxxxxxx> wrote: > > Hi, > > On Sun, 7 Nov 2021 at 22:14, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote: > > > > On Fri, Nov 05, 2021 at 04:01:38PM -0500, Rob Herring wrote: > > > On Wed, Nov 4, 2020 at 1:45 PM <marcandre.lureau@xxxxxxxxxx> wrote: > > > > > > > > From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > > > > > > > > With meson, we have to support out-of-tree build. > > > > > > I noticed that meson still builds pylibfdt/libfdt.py and > > > pylibfdt/libfdt_wrap.c in tree. And it makes the result unusable > > > without installing. For example the README instructions don't work: > > > > > > $ cd pylibfdt > > > $ python3 -c "import libfdt; help(libfdt)" > > > > > > I tried to fix the in tree part with swig option '-outdir', but that > > > didn't work. > > > > Urgh. This has always fit poorly with the rest of the build system. > > In addition, I've discovered that with Fedora 35, I now get this scary warning: > > > > PYMOD pylibfdt/_libfdt.so > > /usr/lib/python3.10/site-packages/setuptools/dist.py:498: UserWarning: The version specified ('1.6.1-g4eda2590-dirty') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details. > > warnings.warn( > > make[1]: Leaving directory '/home/dwg/src/dtc' > > > > Merely replacing 'distutils' with 'setuptools' in the code does not > > fix this. > > I don't know much about this. Python seems to want to use .' 'instead > of '-' but I'm not sure why they decided this so recently. I'm working on patches for both of these issues. > > > Really what I'm after is what uses need to be supported? I'm looking > > > at getting pip and pypi packaging to work. I'm actually wondering if > > > pylibfdt needs to be so tightly coupled to the build system(s!) and > > > source tree. The dependencies are really just libfdt headers and > > > library which are easily installed either from source or a distro pkg. > > > The '..libfdt/' references are problematic with the packaging tools. > > > The easier route may be a standalone repo with a copy of libfdt.i and > > > a different setup.py. > > > > Unfortunately, I don't know enough about either Meson or Python > > packaging to fix this. Simon? > > I'm not quite sure what the problem is with pip3, etc. I am not an > expert on any of these but can probably find some help if we have a > clear problem. Rob, do you have a patch that causes the problem? Python has certain thoughts on what the directory structure looks like and building an sdist can't include something outside of pylibfdt/ (the headers specifically). Basically, this is what needs to work locally for an install from PyPI to work: ./setup.py sdist pip install -f ./dist/ libfdt We also need to statically link if we want to create a wheel (python binary) for PyPI. (setuptools has to be used for a wheel) > I am not keen on splitting the repos as pylibfdt has a source > dependency on libfdt.h Yes, but libfdt.h is part of the ABI and should only change in an ABI compatible way, right? If you really want the version of libfdt you built, you do have to install it AFAICT. I don't think the wrapper will load ../libfdt/libfdt.so. I think the easiest way to solve these problems is moving setup.py up to the project root and perhaps dropping the pylibfdt parts from make/meson. Then working with the python bits all works 'the Python way'. Rob