diff options
author | Vadim Sukhomlinov <sukhomlinov@google.com> | 2020-05-29 15:36:59 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-03 01:20:48 +0000 |
commit | 80f707188fad40701201bc1bb13b4f7558f42528 (patch) | |
tree | b559aac72de6fab06977bbfdd52c4403082f6cec | |
parent | a13bacb6a40997608d6d1955f1cb600dc75b24a1 (diff) | |
download | chrome-ec-80f707188fad40701201bc1bb13b4f7558f42528.tar.gz |
tpm_test: update to swig 4.0 for Python3 support
You may need to do 'sudo emerge swig' to get latest swig installed.
Python3 differentiates between string and bytes, so need proper handling.
BUG=None
TEST=cd test/tpm_test && make
Change-Id: I6e09258a1f6a3fb2923760f446a2ff911e871b40
Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2222978
Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r-- | test/tpm_test/Makefile | 6 | ||||
-rw-r--r-- | test/tpm_test/ftdi_spi_tpm.i | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/test/tpm_test/Makefile b/test/tpm_test/Makefile index e45f32ce0b..d7a2174587 100644 --- a/test/tpm_test/Makefile +++ b/test/tpm_test/Makefile @@ -19,11 +19,13 @@ endif obj = ../../build/tpm_test src = . SWIG = /usr/bin/swig +PYTHON_VERSION = $(shell python3 -c 'import sys; print("%d.%d" % \ +( sys.version_info.major, sys.version_info.minor))') vpath %c $(src) ../../chip/g/dcrypto $(src)/testlib CFLAGS = -fPIC -CFLAGS += -I /usr/include/python2.7 +CFLAGS += -I /usr/include/python$(PYTHON_VERSION) CFLAGS += -I../../../../third_party/cryptoc/include CFLAGS += -I../../board/cr50 CFLAGS += -I../../chip/g @@ -68,7 +70,7 @@ $(obj)/_$(TARGET).so: $(OBJS) $(obj)/$(TARGET).py $(obj)/%_wrap.c: $(src)/%.i $(call echo," SWIG $(notdir $@)") - $(Q)swig -python -outdir $(obj) -o $@ $< + $(Q)$(SWIG) -python -outdir $(obj) -o $@ $< clean: @rm -rf $(obj)/ diff --git a/test/tpm_test/ftdi_spi_tpm.i b/test/tpm_test/ftdi_spi_tpm.i index c9cc2fc535..2bbcded64b 100644 --- a/test/tpm_test/ftdi_spi_tpm.i +++ b/test/tpm_test/ftdi_spi_tpm.i @@ -34,7 +34,7 @@ extern swig_string_data FtdiSendCommandAndWait(char *tpm_command, %typemap(out) swig_string_data { - $result = PyString_FromStringAndSize($1.data, $1.size); + $result = PyBytes_FromStringAndSize($1.data, $1.size); free($1.data); } |