From: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"Hector Oron" <zumbi-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>,
"Peter Robinson"
<pbrobinson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"Marc-André Lureau"
<marcandre.lureau-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Natanael Copa" <ncopa-Tvuechaw34bCfDggNXIi3w@public.gmane.org>
Subject: [PATCH 1/2] pylibfdt: fix swig build in install
Date: Thu, 3 Feb 2022 12:04:07 -0600 [thread overview]
Message-ID: <20220203180408.611645-2-robh@kernel.org> (raw)
In-Reply-To: <20220203180408.611645-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
A 'pip install' is silently broken unless the tree is dirty and contains
pylibfdt/libfdt.py. The problem is a known issue[1] with SWIG and
setuptools where the 'build_py' stage needing module.py runs before
the 'build_ext' stage which generates it. The work-around is to override
'build_py' to run 'build_ext' first.
[1] https://stackoverflow.com/questions/50239473/building-a-module-with-setuptools-and-swig
Signed-off-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
MANIFEST.in | 1 -
setup.py | 8 ++++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/MANIFEST.in b/MANIFEST.in
index d9fb71b77a65..6e7244d195e6 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,7 +6,6 @@ include GPL
include BSD-2-Clause
include setup.py
include pylibfdt/libfdt.i
-include pylibfdt/*.py
include libfdt/libfdt.h
include libfdt/fdt.h
include libfdt/libfdt_env.h
diff --git a/setup.py b/setup.py
index 029aa6182221..a8e54a361512 100755
--- a/setup.py
+++ b/setup.py
@@ -11,6 +11,8 @@ Written by Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
"""
from setuptools import setup, Extension
+from setuptools.command.build_py import build_py as _build_py
+
import os
import re
import sys
@@ -40,11 +42,17 @@ libfdt_module = Extension(
swig_opts=['-I' + os.path.join(srcdir, 'libfdt')],
)
+class build_py(_build_py):
+ def run(self):
+ self.run_command("build_ext")
+ return super().run()
+
setup(
name='libfdt',
use_scm_version={
"root": srcdir,
},
+ cmdclass = {'build_py' : build_py},
setup_requires = ['setuptools_scm'],
author='Simon Glass',
author_email='sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org',
--
2.32.0
next prev parent reply other threads:[~2022-02-03 18:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 18:04 [PATCH 0/2] More pylibfdt setup.py rework Rob Herring
[not found] ` <20220203180408.611645-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-02-03 18:04 ` Rob Herring [this message]
[not found] ` <20220203180408.611645-2-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-02-04 6:44 ` [PATCH 1/2] pylibfdt: fix swig build in install David Gibson
2022-02-03 18:04 ` [PATCH 2/2] pylibfdt: Compile and build libfdt directly into shim library Rob Herring
[not found] ` <20220203180408.611645-3-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-02-08 5:51 ` David Gibson
2022-02-08 16:00 ` Rob Herring
[not found] ` <CAL_JsqJ6WR=+VpcfVZn+=J_-AU6Xs7QGsKdWAjSW4u19e54Vdw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-02-10 4:31 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220203180408.611645-2-robh@kernel.org \
--to=robh-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marcandre.lureau-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ncopa-Tvuechaw34bCfDggNXIi3w@public.gmane.org \
--cc=pbrobinson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=zumbi-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.