From 87485a3f2825f6a644e860db748ca2616797d92d Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 17 Nov 2021 19:17:03 +0100 Subject: [PATCH] Add requirement on Jinja to integrate drivers Driver implementers need to regenerate wrappers. This will use Jinja2 as discussed in https://github.com/ARMmbed/mbedtls/pull/5067#discussion_r738794607 On the development branch, driver integration is always needed to generate the driver wrapper and thus to build the library, so this requirement applies to everyone, not just driver implementers. In releases, we plan to include a default driver wrapper with support for basic use cases only, meaning that the line `-r driver.requirements.txt` should be removed from `basic.requirements.txt` in releases. Signed-off-by: Gilles Peskine --- README.md | 5 ++++- scripts/basic.requirements.txt | 5 +++++ scripts/ci.requirements.txt | 2 ++ scripts/driver.requirements.txt | 9 +++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 scripts/basic.requirements.txt create mode 100644 scripts/driver.requirements.txt diff --git a/README.md b/README.md index c8d94500e2..ea1d7a37b7 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,10 @@ The source code of Mbed TLS includes some files that are automatically generated The following tools are required: * Perl, for some library source files and for Visual Studio build files. -* Python 3, for some sample programs and test data. +* Python 3 and some Python packages, for some library source files, sample programs and test data. To install the necessary packages, run + ``` + python -m pip install -r scripts/basic.requirements.txt + ``` * A C compiler for the host platform, for some test data. If you are cross-compiling, you must set the `CC` environment variable to a C compiler for the host platform when generating the configuration-independent files. diff --git a/scripts/basic.requirements.txt b/scripts/basic.requirements.txt new file mode 100644 index 0000000000..1be3d0c235 --- /dev/null +++ b/scripts/basic.requirements.txt @@ -0,0 +1,5 @@ +# Python modules required to build Mbed TLS in ordinary conditions. + +# Required to (re-)generate source files. Not needed if the generated source +# files are already present and up-to-date. +-r driver.requirements.txt diff --git a/scripts/ci.requirements.txt b/scripts/ci.requirements.txt index 18b40ec173..209ae3d8ff 100644 --- a/scripts/ci.requirements.txt +++ b/scripts/ci.requirements.txt @@ -1,5 +1,7 @@ # Python package requirements for Mbed TLS testing. +-r driver.requirements.txt + # Use a known version of Pylint, because new versions tend to add warnings # that could start rejecting our code. # 2.4.4 is the version in Ubuntu 20.04. It supports Python >=3.5. diff --git a/scripts/driver.requirements.txt b/scripts/driver.requirements.txt new file mode 100644 index 0000000000..5a3e76a0ec --- /dev/null +++ b/scripts/driver.requirements.txt @@ -0,0 +1,9 @@ +# Python package requirements for driver implementers. + +# Use the version of Jinja that's in Ubuntu 20.04. +# See https://github.com/ARMmbed/mbedtls/pull/5067#discussion_r738794607 . +# Note that Jinja2 3.0 drops support for Python 3.5, so we need 2.x. +Jinja2 >= 2.10.1 +# Jinja2 >=2.10, <<3.0 needs a separate package for type annotations +types-Jinja2 +