Skip to contentSkip to conversation

qapi: check for python, allow path to be specified

PATCH In review Michael Roth 2 participants 5 messages Jul 24, 2011 – Jul 25, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 qapi: check for python, allow path to be specified

QAPI requires python to generate code. Check for python during configuration and allow python to be specified manually.

---
 Makefile  |   12 ++++++------
 configure |   13 +++++++++++++
 2 files changed, 19 insertions(+), 6 deletions(-)
Makefile +6 -6
index f3a03ad..daa3aa0 100644
@@ -168,22 +168,22 @@ test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-di
 
 $(qapi-dir)/test-qapi-types.c: $(qapi-dir)/test-qapi-types.h
 $(qapi-dir)/test-qapi-types.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
-	$(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
 $(qapi-dir)/test-qapi-visit.c: $(qapi-dir)/test-qapi-visit.h
 $(qapi-dir)/test-qapi-visit.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
-	$(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
 $(qapi-dir)/test-qmp-commands.h: $(qapi-dir)/test-qmp-marshal.c
 $(qapi-dir)/test-qmp-marshal.c: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
-	    $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
+	    $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
 
 $(qapi-dir)/qga-qapi-types.c: $(qapi-dir)/qga-qapi-types.h
 $(qapi-dir)/qga-qapi-types.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py
-	$(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
 $(qapi-dir)/qga-qapi-visit.c: $(qapi-dir)/qga-qapi-visit.h
 $(qapi-dir)/qga-qapi-visit.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py
-	$(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
 $(qapi-dir)/qga-qmp-marshal.c: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py
-	$(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
+	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
 
 test-visitor.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h) $(qapi-obj-y)
 test-visitor: test-visitor.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o qemu-malloc.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o
configure +13 -0
index 600da9b..16652b5 100755
@@ -225,6 +225,7 @@ strip="${cross_prefix}${STRIP-strip}"
 windres="${cross_prefix}${WINDRES-windres}"
 pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}"
 sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"
+python="${cross_prefix}${PYTHON-python}"
 
 # default flags for all hosts
 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
@@ -748,6 +749,8 @@ for opt do
   ;;
   --enable-usb-redir) usb_redir="yes"
   ;;
+  --python=*) python="$optarg"
+  ;;
   *) echo "ERROR: unknown option $opt"; show_help="yes"
   ;;
   esac
@@ -1025,6 +1028,7 @@ echo "  --disable-smartcard-nss  disable smartcard nss support"
 echo "  --enable-smartcard-nss   enable smartcard nss support"
 echo "  --disable-usb-redir      disable usb network redirection support"
 echo "  --enable-usb-redir       enable usb network redirection support"
+echo "  --python=PATH            path to python executable [$python]"
 echo ""
 echo "NOTE: The object files are built at the place where configure is launched"
 exit 1
@@ -1810,6 +1814,13 @@ EOF
 fi
 
 ##########################################
+# python probe
+if ! has $python; then
+    echo "python executable not found: $python. You can specify with --python"
+    exit 1
+fi
+
+##########################################
 # glib support probe
 if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then
     glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
@@ -2655,6 +2666,7 @@ echo "xfsctl support    $xfs"
 echo "nss used          $smartcard_nss"
 echo "usb net redir     $usb_redir"
 echo "OpenGL support    $opengl"
+echo "python            $python"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -3026,6 +3038,7 @@ echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
 echo "LIBS+=$LIBS" >> $config_host_mak
 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
+echo "PYTHON=$python" >> $config_host_mak
 
 # generate list of library paths for linker script
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 2/2 guest agent: add --enable-guest-agent config option

QAPI will require glib/python, but for now the guest agent is the only user. For now, make these dependencies an explicit guest agent one, and give users the option to disable it if need be.

Once QAPI is adopted in core QEMU code, we would basically revert this patch.

---
 configure |   36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)
configure +25 -11
index 16652b5..0099ecb 100755
@@ -179,6 +179,7 @@ smartcard=""
 smartcard_nss=""
 usb_redir=""
 opengl=""
+guest_agent="yes"
 
 # parse CC options first
 for opt do
@@ -749,6 +750,10 @@ for opt do
   ;;
   --enable-usb-redir) usb_redir="yes"
   ;;
+  --enable-guest-agent) guest_agent="yes"
+  ;;
+  --disable-guest-agent) guest_agent="no"
+  ;;
   --python=*) python="$optarg"
   ;;
   *) echo "ERROR: unknown option $opt"; show_help="yes"
@@ -1028,6 +1033,8 @@ echo "  --disable-smartcard-nss  disable smartcard nss support"
 echo "  --enable-smartcard-nss   enable smartcard nss support"
 echo "  --disable-usb-redir      disable usb network redirection support"
 echo "  --enable-usb-redir       enable usb network redirection support"
+echo "  --disable-guest-agent    disable building of the QEMU Guest Agent"
+echo "  --enable-guest-agent     enable building of the QEMU Guest Agent"
 echo "  --python=PATH            path to python executable [$python]"
 echo ""
 echo "NOTE: The object files are built at the place where configure is launched"
@@ -1815,21 +1822,25 @@ fi
 
 ##########################################
 # python probe
-if ! has $python; then
-    echo "python executable not found: $python. You can specify with --python"
-    exit 1
+if test "$guest_agent" != "no" ; then
+    if ! has $python; then
+        echo "python executable not found: $python. You can specify with --python"
+        exit 1
+    fi
 fi
 
 ##########################################
 # glib support probe
-if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then
-    glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
-    glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null`
-    libs_softmmu="$glib_libs $libs_softmmu"
-    libs_tools="$glib_libs $libs_tools"
-else
-    echo "glib-2.0 required to compile QEMU"
-    exit 1
+if test "$guest_agent" != "no" ; then
+    if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then
+        glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
+        glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null`
+        libs_softmmu="$glib_libs $libs_softmmu"
+        libs_tools="$glib_libs $libs_tools"
+    else
+        echo "glib-2.0 required to compile QEMU"
+        exit 1
+    fi
 fi
 
 ##########################################
@@ -2566,7 +2577,9 @@ if test "$softmmu" = yes ; then
   tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
       tools="qemu-nbd\$(EXESUF) $tools"
+    if [ "$guest_agent" = "yes" ]; then
       tools="qemu-ga\$(EXESUF) $tools"
+    fi
     if [ "$check_utests" = "yes" ]; then
       tools="check-qint check-qstring check-qdict check-qlist $tools"
       tools="check-qfloat check-qjson $tools"
@@ -2666,6 +2679,7 @@ echo "xfsctl support    $xfs"
 echo "nss used          $smartcard_nss"
 echo "usb net redir     $usb_redir"
 echo "OpenGL support    $opengl"
+echo "build guest agent $guest_agent"
 echo "python            $python"
 
 if test $sdl_too_old = "yes"; then
Signature · 1 line
1.7.0.4
#2 lore raw
In reply to Michael Roth
Quoted 2 lines · Michael Roth

QAPI requires python to generate code. Check for python during configuration and allow python to be specified manually.

Now your patch is almost identical to mine. Maybe you missed it:
http://lists.nongnu.org/archive/html/qemu-devel/2011-07/msg02373.html.

There is still one difference, my version puts the python stuff close to make and install handling, which is more logical since they all are build tools.

Quoted 102 lines

---
 Makefile  |   12 ++++++------
 configure |   13 +++++++++++++

 2 files changed, 19 insertions(+), 6 deletions(-)
Makefile +0 -0
index f3a03ad..daa3aa0 100644
@@ -168,22 +168,22 @@ test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-di
 

 $(qapi-dir)/test-qapi-types.c: $(qapi-dir)/test-qapi-types.h
 $(qapi-dir)/test-qapi-types.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@") $(qapi-dir)/test-qapi-visit.c: $(qapi-dir)/test-qapi-visit.h
 $(qapi-dir)/test-qapi-visit.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@") $(qapi-dir)/test-qmp-commands.h: $(qapi-dir)/test-qmp-marshal.c
 $(qapi-dir)/test-qmp-marshal.c: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
-           $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")
+           $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-" < $<, "  GEN   $@")

 $(qapi-dir)/qga-qapi-types.c: $(qapi-dir)/qga-qapi-types.h
 $(qapi-dir)/qga-qapi-types.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@") $(qapi-dir)/qga-qapi-visit.c: $(qapi-dir)/qga-qapi-visit.h
 $(qapi-dir)/qga-qapi-visit.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@") $(qapi-dir)/qga-qmp-marshal.c: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-" < $<, "  GEN   $@")

 test-visitor.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h) $(qapi-obj-y)
 test-visitor: test-visitor.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o qemu-malloc.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o

configure +0 -0
index 600da9b..16652b5 100755
@@ -225,6 +225,7 @@ strip="${cross_prefix}${STRIP-strip}"

 windres="${cross_prefix}${WINDRES-windres}" pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}" sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}" +python="${cross_prefix}${PYTHON-python}"

 # default flags for all hosts
 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
configure +0 -0
@@ -748,6 +749,8 @@ for opt do
   ;;

  --enable-usb-redir) usb_redir="yes"
  ;;
+  --python=*) python="$optarg"
+  ;;
  *) echo "ERROR: unknown option $opt"; show_help="yes" ;;
  esac

configure +0 -0
@@ -1025,6 +1028,7 @@ echo "  --disable-smartcard-nss  disable smartcard nss support"

 echo "  --enable-smartcard-nss   enable smartcard nss support"
 echo "  --disable-usb-redir      disable usb network redirection support" echo "  --enable-usb-redir       enable usb network redirection support" +echo "  --python=PATH            path to python executable [$python]" echo ""
 echo "NOTE: The object files are built at the place where configure is launched" exit 1

configure +0 -0
@@ -1810,6 +1814,13 @@ EOF

 fi

 ##########################################

configure +7 -0
+# python probe
+if ! has $python; then
+    echo "python executable not found: $python. You can specify with --python"
+    exit 1
+fi
+
+##########################################
 # glib support probe
 if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then
    glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
configure +0 -0
@@ -2655,6 +2666,7 @@ echo "xfsctl support    $xfs"

 echo "nss used          $smartcard_nss"
 echo "usb net redir     $usb_redir"
 echo "OpenGL support    $opengl"
+echo "python            $python"

 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"

configure +0 -0
@@ -3026,6 +3038,7 @@ echo "ARLIBS_END=$arlibs_end" >> $config_host_mak

 echo "LIBS+=$LIBS" >> $config_host_mak echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak +echo "PYTHON=$python" >> $config_host_mak

 # generate list of library paths for linker script

--
1.7.0.4

#3 lore raw
Quoted 7 lines · Blue Swirl
Quoted 2 lines · Michael Roth

QAPI requires python to generate code. Check for python during configuration and allow python to be specified manually.

Now your patch is almost identical to mine. Maybe you missed it:
http://lists.nongnu.org/archive/html/qemu-devel/2011-07/msg02373.html.

Doh! Yah must've missed it, thought you hadn't sent yet.

Quoted 4 lines

There is still one difference, my version puts the python stuff close to make and install handling, which is more logical since they all are build tools.

Agreed. Let's stick with your patch :)

Quoted 102 lines
Quoted 102 lines
---
  Makefile  |   12 ++++++------
  configure |   13 +++++++++++++
  2 files changed, 19 insertions(+), 6 deletions(-)
Makefile +6 -6
index f3a03ad..daa3aa0 100644
@@ -168,22 +168,22 @@ test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-di
 
  $(qapi-dir)/test-qapi-types.c: $(qapi-dir)/test-qapi-types.h
  $(qapi-dir)/test-qapi-types.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@")
  $(qapi-dir)/test-qapi-visit.c: $(qapi-dir)/test-qapi-visit.h
  $(qapi-dir)/test-qapi-visit.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@")
  $(qapi-dir)/test-qmp-commands.h: $(qapi-dir)/test-qmp-marshal.c
  $(qapi-dir)/test-qmp-marshal.c: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
-           $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@")
+           $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@")
 
  $(qapi-dir)/qga-qapi-types.c: $(qapi-dir)/qga-qapi-types.h
  $(qapi-dir)/qga-qapi-types.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
  $(qapi-dir)/qga-qapi-visit.c: $(qapi-dir)/qga-qapi-visit.h
  $(qapi-dir)/qga-qapi-visit.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
  $(qapi-dir)/qga-qmp-marshal.c: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
 
  test-visitor.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h) $(qapi-obj-y)
  test-visitor: test-visitor.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o qemu-malloc.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o
configure +13 -1
index 600da9b..16652b5 100755
@@ -225,6 +225,7 @@ strip="${cross_prefix}${STRIP-strip}"
  windres="${cross_prefix}${WINDRES-windres}"
  pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}"
  sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"
+python="${cross_prefix}${PYTHON-python}"
 
  # default flags for all hosts
  QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
@@ -748,6 +749,8 @@ for opt do
   ;;
   --enable-usb-redir) usb_redir="yes"
   ;;
+  --python=*) python="$optarg"
+  ;;
   *) echo "ERROR: unknown option $opt"; show_help="yes"
   ;;
   esac
@@ -1025,6 +1028,7 @@ echo "  --disable-smartcard-nss  disable smartcard nss support"
  echo "  --enable-smartcard-nss   enable smartcard nss support"
  echo "  --disable-usb-redir      disable usb network redirection support"
  echo "  --enable-usb-redir       enable usb network redirection support"
+echo "  --python=PATH            path to python executable [$python]"
  echo ""
  echo "NOTE: The object files are built at the place where configure is launched"
  exit 1
@@ -1810,6 +1814,13 @@ EOF
  fi
 
  ##########################################
+# python probe
+if ! has $python; then
+    echo "python executable not found: $python. You can specify with --python"
+    exit 1
+fi
+
+##########################################
  # glib support probe
  if $pkg_config --modversion glib-2.0>  /dev/null 2>&1 ; then
     glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
@@ -2655,6 +2666,7 @@ echo "xfsctl support    $xfs"
  echo "nss used          $smartcard_nss"
  echo "usb net redir     $usb_redir"
  echo "OpenGL support    $opengl"
+echo "python            $python"
 
  if test $sdl_too_old = "yes"; then
  echo "->  Your SDL version is too old - please upgrade to have SDL support"
@@ -3026,6 +3038,7 @@ echo "ARLIBS_END=$arlibs_end">>  $config_host_mak
  echo "LIBS+=$LIBS">>  $config_host_mak
  echo "LIBS_TOOLS+=$libs_tools">>  $config_host_mak
  echo "EXESUF=$EXESUF">>  $config_host_mak
+echo "PYTHON=$python">>  $config_host_mak
 
  # generate list of library paths for linker script
 
--

1.7.0.4

#4 lore raw
Quoted 12 lines · Michael Roth
Quoted 10 lines · Blue Swirl
Quoted 3 lines · Michael Roth

QAPI requires python to generate code. Check for python during configuration and allow python to be specified manually.

Now your patch is almost identical to mine. Maybe you missed it:
http://lists.nongnu.org/archive/html/qemu-devel/2011-07/msg02373.html.

Quoted 8 lines

Doh! Yah must've missed it, thought you hadn't sent yet.

Quoted 4 lines

There is still one difference, my version puts the python stuff close to make and install handling, which is more logical since they all are build tools.

Agreed. Let's stick with your patch :)

OK, I've pushed it.

Quoted 135 lines
Quoted 133 lines
Quoted 133 lines

---
 Makefile  |   12 ++++++------
 configure |   13 +++++++++++++

 2 files changed, 19 insertions(+), 6 deletions(-)
Makefile +0 -0
index f3a03ad..daa3aa0 100644
@@ -168,22 +168,22 @@ test-visitor.o test-qmp-commands.o

qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-di

 $(qapi-dir)/test-qapi-types.c: $(qapi-dir)/test-qapi-types.h $(qapi-dir)/test-qapi-types.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@") $(qapi-dir)/test-qapi-visit.c: $(qapi-dir)/test-qapi-visit.h $(qapi-dir)/test-qapi-visit.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-visit.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "test-"<  $<, "  GEN   $@") $(qapi-dir)/test-qmp-commands.h: $(qapi-dir)/test-qmp-marshal.c $(qapi-dir)/test-qmp-marshal.c: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-commands.py
-           $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-"<  $<, " GEN   $@")
+           $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "test-"<  $<, " GEN   $@")

 $(qapi-dir)/qga-qapi-types.c: $(qapi-dir)/qga-qapi-types.h $(qapi-dir)/qga-qapi-types.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-types.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@") $(qapi-dir)/qga-qapi-visit.c: $(qapi-dir)/qga-qapi-visit.h $(qapi-dir)/qga-qapi-visit.h: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-visit.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@") $(qapi-dir)/qga-qmp-marshal.c: $(SRC_PATH)/qapi-schema-guest.json $(SRC_PATH)/scripts/qapi-commands.py
-       $(call quiet-command,python $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN   $@")
+       $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-commands.py -o "$(qapi-dir)" -p "qga-"<  $<, "  GEN $@")

 test-visitor.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h) $(qapi-obj-y)
 test-visitor: test-visitor.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o qemu-malloc.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o

configure +0 -0
index 600da9b..16652b5 100755
@@ -225,6 +225,7 @@ strip="${cross_prefix}${STRIP-strip}"

 windres="${cross_prefix}${WINDRES-windres}" pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}" sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}" +python="${cross_prefix}${PYTHON-python}"

 # default flags for all hosts
 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
configure +0 -0
@@ -748,6 +749,8 @@ for opt do
   ;;

  --enable-usb-redir) usb_redir="yes"
  ;;
+  --python=*) python="$optarg"
+  ;;
  *) echo "ERROR: unknown option $opt"; show_help="yes" ;;
  esac

configure +0 -0
@@ -1025,6 +1028,7 @@ echo "  --disable-smartcard-nss  disable smartcard

nss support"
 echo "  --enable-smartcard-nss   enable smartcard nss support" echo "  --disable-usb-redir      disable usb network redirection support"
 echo "  --enable-usb-redir       enable usb network redirection support" +echo "  --python=PATH            path to python executable [$python]" echo ""
 echo "NOTE: The object files are built at the place where configure is launched"
 exit 1

configure +0 -0
@@ -1810,6 +1814,13 @@ EOF

 fi

 ##########################################

configure +7 -1
+# python probe
+if ! has $python; then
+    echo "python executable not found: $python. You can specify with
--python"
+    exit 1
+fi
+
+##########################################
 # glib support probe
 if $pkg_config --modversion glib-2.0>  /dev/null 2>&1 ; then
    glib_cflags=`$pkg_config --cflags glib-2.0 2>/dev/null`
configure +0 -0
@@ -2655,6 +2666,7 @@ echo "xfsctl support    $xfs"

 echo "nss used          $smartcard_nss"
 echo "usb net redir     $usb_redir"
 echo "OpenGL support    $opengl"
+echo "python            $python"

 if test $sdl_too_old = "yes"; then
 echo "->  Your SDL version is too old - please upgrade to have SDL support"

configure +0 -0
@@ -3026,6 +3038,7 @@ echo "ARLIBS_END=$arlibs_end">>  $config_host_mak

 echo "LIBS+=$LIBS">>  $config_host_mak echo "LIBS_TOOLS+=$libs_tools">>  $config_host_mak echo "EXESUF=$EXESUF">>  $config_host_mak +echo "PYTHON=$python">>  $config_host_mak

 # generate list of library paths for linker script

--
1.7.0.4