From 29c5b1f1b53010a49d2ce1cc59060c334b1a40fc Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 20 Mar 2020 15:11:31 +0800
Subject: [PATCH] python: separate host/target python for cross-compile

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 Makefile.am       | 2 +-
 m4/openvswitch.m4 | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index b279303d1..6140b2c7f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -60,7 +60,7 @@ endif
 # foo/__init__.pyc will cause Python to ignore foo.py.
 run_python = \
 	PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
-	PYTHONDONTWRITEBYTECODE=yes $(PYTHON3)
+	PYTHONDONTWRITEBYTECODE=yes $(PYTHON3_HOST)
 
 ALL_LOCAL =
 BUILT_SOURCES =
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index add3aabcc..ada31c491 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -383,6 +383,8 @@ else:
      AC_MSG_ERROR([Python 3.4 or later is required but not found in $PATH, please install it or set $PYTHON3 to point to it])
    fi
    AC_ARG_VAR([PYTHON3])
+   PYTHON3_HOST=$ovs_cv_python3_host
+   AM_MISSING_PROG([PYTHON3_HOST], [python3])
    PYTHON3=$ovs_cv_python3])
 
 dnl Checks for flake8.
