diff --git a/framework b/framework index 81dfe001e..71171b77f 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit 81dfe001e19c8d2c09d2ac1df2f5d655b0f04a7d +Subproject commit 71171b77f50302206cc87b93bc8bf76f16b6e1c4 diff --git a/scripts/basic.requirements.txt b/scripts/basic.requirements.txt new file mode 100644 index 000000000..1be3d0c23 --- /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 new file mode 100644 index 000000000..fc10c63b8 --- /dev/null +++ b/scripts/ci.requirements.txt @@ -0,0 +1,28 @@ +# 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. +pylint == 2.4.4 + +# Use a version of mypy that is compatible with our code base. +# mypy <0.940 is known not to work: see commit +# :/Upgrade mypy to the last version supporting Python 3.6 +# mypy >=0.960 is known not to work: +# https://github.com/Mbed-TLS/mbedtls-framework/issues/50 +# mypy 0.942 is the version in Ubuntu 22.04. +mypy == 0.942 + +# At the time of writing, only needed for tests/scripts/audit-validity-dates.py. +# It needs >=35.0.0 for correct operation, and that requires Python >=3.6, +# but our CI has Python 3.5. So let pip install the newest version that's +# compatible with the running Python: this way we get something good enough +# for mypy and pylint under Python 3.5, and we also get something good enough +# to run audit-validity-dates.py on Python >=3.6. +cryptography # >= 35.0.0 + +# For building `framework/data_files/server9-bad-saltlen.crt` and check python +# files. +asn1crypto diff --git a/scripts/driver.requirements.txt b/scripts/driver.requirements.txt new file mode 100644 index 000000000..7b002ec78 --- /dev/null +++ b/scripts/driver.requirements.txt @@ -0,0 +1,19 @@ +# Python package requirements for driver implementers. + +# Jinja2 <3.0 needs an older version of markupsafe, but does not +# declare it. +# https://github.com/pallets/markupsafe/issues/282 +# https://github.com/pallets/jinja/issues/1585 +markupsafe < 2.1 + +# Use the version of Jinja that's in Ubuntu 20.04. +# See https://github.com/Mbed-TLS/mbedtls/pull/5067#discussion_r738794607 . +# Note that Jinja 3.0 drops support for Python 3.5, so we need to support +# Jinja 2.x as long as we're still using Python 3.5 anywhere. +# Jinja 2.10.1 doesn't support Python 3.10+ +Jinja2 >= 2.10.1; python_version < '3.10' +Jinja2 >= 2.10.3; python_version >= '3.10' +# Jinja2 >=2.10, <3.0 needs a separate package for type annotations +types-Jinja2 >= 2.11.9 +jsonschema >= 3.2.0 +types-jsonschema >= 3.2.0 diff --git a/scripts/maintainer.requirements.txt b/scripts/maintainer.requirements.txt new file mode 100644 index 000000000..b149921a2 --- /dev/null +++ b/scripts/maintainer.requirements.txt @@ -0,0 +1,10 @@ +# Python packages that are only useful to Mbed TLS maintainers. + +-r ci.requirements.txt + +# For source code analyses +clang + +# For building some test vectors +pycryptodomex +pycryptodome-test-vectors diff --git a/scripts/min_requirements.py b/scripts/min_requirements.py new file mode 100755 index 000000000..a67b761a3 --- /dev/null +++ b/scripts/min_requirements.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +"""Install all the required Python packages, with the minimum Python version. +""" + +# Copyright The Mbed TLS Contributors +# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + +import os +import framework_scripts_path # pylint: disable=unused-import +from mbedtls_framework import min_requirements + +# The default file is located in the same folder as this script. +DEFAULT_REQUIREMENTS_FILE = 'ci.requirements.txt' + +min_requirements.main(os.path.join(os.path.dirname(__file__), + DEFAULT_REQUIREMENTS_FILE))