Hi On Wed, Oct 9, 2019 at 10:49 AM Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> wrote: > > On Wed, Oct 9, 2019 at 8:03 AM David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote: > > > > On Mon, Oct 07, 2019 at 11:18:01PM +0400, marcandre.lureau@xxxxxxxxxx wrote: > > > From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > > > > > > With meson, we have to support out-of-tree build. Fix path lookup. > > > > Again, a good idea, regardless of build system. Integration of the > > python setuptools stuff with the rest of the build has always > > been... mucky :/. > > > > > > > > Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > > > --- > > > pylibfdt/setup.py | 12 ++++++------ > > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > > > diff --git a/pylibfdt/setup.py b/pylibfdt/setup.py > > > index 53f2bef..fd50b6c 100755 > > > --- a/pylibfdt/setup.py > > > +++ b/pylibfdt/setup.py > > > @@ -20,22 +20,21 @@ VERSION_PATTERN = '^#define DTC_VERSION "DTC ([^"]*)"$' > > > > > > > > > def get_version(): > > > - version_file = "../version_gen.h" > > > + version_file = "version_gen.h" > > > f = open(version_file, 'rt') > > > m = re.match(VERSION_PATTERN, f.readline()) > > > return m.group(1) > > > > > > > > > setupdir = os.path.dirname(os.path.abspath(sys.argv[0])) > > > -os.chdir(setupdir) > > > > > > libfdt_module = Extension( > > > '_libfdt', > > > - sources=['libfdt.i'], > > > - include_dirs=['../libfdt'], > > > + sources=[os.path.join(setupdir, 'libfdt.i')], > > > + include_dirs=[os.path.join(setupdir, '../libfdt')], > > > libraries=['fdt'], > > > - library_dirs=['../libfdt'], > > > - swig_opts=['-I../libfdt'], > > > + library_dirs=[os.path.join(setupdir, '../libfdt')], > > > > Is this one right? Won't this be looking for the generated .so or .a, > > which will be in the target dirs, not the srcdir? > > No, it looks wrong. Whatever path I put there, it seems to work > regardless. Not sure if we really need it. Ah it was linking with the system one, or my local tree build. I think we better give the build directory as argument to setup.py. I will update the patch. > > > > > > + swig_opts=['-I' + os.path.join(setupdir, '../libfdt')], > > > ) > > > > > > setup( > > > @@ -44,5 +43,6 @@ setup( > > > author='Simon Glass <sjg@xxxxxxxxxxxx>', > > > description='Python binding for libfdt', > > > ext_modules=[libfdt_module], > > > + package_dir={'': setupdir}, > > > py_modules=['libfdt'], > > > ) > > > > -- > > David Gibson | I'll have my music baroque, and my code > > david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ > > | _way_ _around_! > > http://www.ozlabs.org/~dgibson