The python/build folder contents are completely unrelated to the ovs
python bindings. These files are only used during the build for various
subsystems (docs, man pages, code generation, etc.).

Having that folder in that location prevents from running:

        cd python && python3 -m build

Which is a way to generate PEP517 compatible source archives and binary
wheel packages.

Move that folder into build-aux. Update PYTHONPATH accordingly.

Link: https://peps.python.org/pep-0517/
Link: https://pypi.org/project/build/
Signed-off-by: Robin Jarry <rja...@redhat.com>
---
 Makefile.am                                       |  6 +++---
 build-aux/automake.mk                             |  8 ++++++++
 {python => build-aux}/build/__init__.py           |  0
 {python => build-aux}/build/extract_ofp_fields.py |  0
 {python => build-aux}/build/nroff.py              |  0
 {python => build-aux}/build/soutil.py             |  0
 python/automake.mk                                | 12 ------------
 7 files changed, 11 insertions(+), 15 deletions(-)
 rename {python => build-aux}/build/__init__.py (100%)
 rename {python => build-aux}/build/extract_ofp_fields.py (100%)
 rename {python => build-aux}/build/nroff.py (100%)
 rename {python => build-aux}/build/soutil.py (100%)

diff --git a/Makefile.am b/Makefile.am
index db341504d37f..fca138ea9fd6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,7 +58,7 @@ endif
 # foo/__init__.py into an (older) version with plain foo.py, since
 # foo/__init__.pyc will cause Python to ignore foo.py.
 run_python = \
-       PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
+       
PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/build-aux$(psep)$$PYTHONPATH
 \
        PYTHONDONTWRITEBYTECODE=yes $(PYTHON3)
 
 ALL_LOCAL =
@@ -151,7 +151,7 @@ ro_shell = printf '\043 Generated automatically -- do not 
modify!    -*- buffer-
 
 SUFFIXES += .in
 .in:
-       $(AM_V_GEN)PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3) 
$(srcdir)/build-aux/soexpand.py -I$(srcdir) < $< | \
+       $(AM_V_GEN)$(PYTHON3) $(srcdir)/build-aux/soexpand.py -I$(srcdir) < $< 
| \
          $(PYTHON3) $(srcdir)/build-aux/dpdkstrip.py $(DPDKSTRIP_FLAGS) | \
          sed \
            -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
@@ -416,7 +416,7 @@ CLEANFILES += flake8-check
 
 -include manpages.mk
 manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py python/build/soutil.py
-       @PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3) 
$(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
+       @$(PYTHON3) $(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) 
$(MAN_ROOTS) >$(@F).tmp
        @if cmp -s $(@F).tmp $@; then \
          touch $@; \
          rm -f $(@F).tmp; \
diff --git a/build-aux/automake.mk b/build-aux/automake.mk
index b9a77a51cfed..b4426d7b23dd 100644
--- a/build-aux/automake.mk
+++ b/build-aux/automake.mk
@@ -1,4 +1,8 @@
 EXTRA_DIST += \
+       build-aux/build/__init__.py \
+       build-aux/build/extract_ofp_fields.py \
+       build-aux/build/nroff.py \
+       build-aux/build/soutil.py \
        build-aux/calculate-schema-cksum \
        build-aux/cccl \
        build-aux/cksum-schema-check \
@@ -13,6 +17,10 @@ EXTRA_DIST += \
        build-aux/xml2nroff
 
 FLAKE8_PYFILES += \
+    build-aux/build/__init__.py \
+    build-aux/build/extract_ofp_fields.py \
+    build-aux/build/nroff.py \
+    build-aux/build/soutil.py \
     build-aux/dpdkstrip.py \
     build-aux/gen_ofp_field_decoders \
     build-aux/sodepends.py \
diff --git a/python/build/__init__.py b/build-aux/build/__init__.py
similarity index 100%
rename from python/build/__init__.py
rename to build-aux/build/__init__.py
diff --git a/python/build/extract_ofp_fields.py 
b/build-aux/build/extract_ofp_fields.py
similarity index 100%
rename from python/build/extract_ofp_fields.py
rename to build-aux/build/extract_ofp_fields.py
diff --git a/python/build/nroff.py b/build-aux/build/nroff.py
similarity index 100%
rename from python/build/nroff.py
rename to build-aux/build/nroff.py
diff --git a/python/build/soutil.py b/build-aux/build/soutil.py
similarity index 100%
rename from python/build/soutil.py
rename to build-aux/build/soutil.py
diff --git a/python/automake.mk b/python/automake.mk
index 82a50878741a..8b6266de214e 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -63,14 +63,6 @@ ovs_pytests = \
        python/ovs/tests/test_odp.py \
        python/ovs/tests/test_ofp.py
 
-# These python files are used at build time but not runtime,
-# so they are not installed.
-EXTRA_DIST += \
-       python/build/__init__.py \
-       python/build/extract_ofp_fields.py \
-       python/build/nroff.py \
-       python/build/soutil.py
-
 # PyPI support.
 EXTRA_DIST += \
        python/ovs/compat/sortedcontainers/LICENSE \
@@ -88,10 +80,6 @@ PYCOV_CLEAN_FILES += $(PYFILES:.py=.py,cover)
 
 FLAKE8_PYFILES += \
        $(filter-out python/ovs/compat/% python/ovs/dirs.py,$(PYFILES)) \
-       python/build/__init__.py \
-       python/build/extract_ofp_fields.py \
-       python/build/nroff.py \
-       python/build/soutil.py \
        python/ovs/dirs.py.template \
        python/setup.py
 
-- 
2.41.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to