From 2f56af6fc6e5416a1f34c70222678b92ab173bb9 Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Thu, 28 Sep 2023 12:48:05 +0200 Subject: [PATCH] feat(package-managers/python)!: Support Python 3.11 Add "3.11" to the list of python versions which ORT allows to pass to the `-p` option of `python-inspector`. This enables the successful analysis of Python projects which require Python 3.11 via both, `Pip` and `Poetry`. In particular, it does not seem to require upgrading the Python installation to version 3.11. The change is breaking, because also the default Python version is changed to 3.11. For analyzing Python projects targeting 3.10 the Python version as of now must be explicitly specified. Note: The reason why the binary artifact URL of `MarkupSafe` became empty in the expected result for the test is simply, because there is no "Built Distribution", but only a "Source Distribution", see [1]. Furthermore, it's still correct to list `MarkupSafe` as dependency, because it specifies `>= 3.6` as Python version constraint, mich matches version 3.11. [1] https://pypi.org/project/MarkupSafe/2.0.1/#files Signed-off-by: Frank Viernau --- .../assets/projects/synthetic/poetry-expected-output.yml | 6 +++--- plugins/package-managers/python/src/main/kotlin/Pip.kt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/package-managers/python/src/funTest/assets/projects/synthetic/poetry-expected-output.yml b/plugins/package-managers/python/src/funTest/assets/projects/synthetic/poetry-expected-output.yml index 969ec655d436c..6b99a66899f07 100644 --- a/plugins/package-managers/python/src/funTest/assets/projects/synthetic/poetry-expected-output.yml +++ b/plugins/package-managers/python/src/funTest/assets/projects/synthetic/poetry-expected-output.yml @@ -103,10 +103,10 @@ packages: description: "Safely add untrusted strings to HTML/XML markup." homepage_url: "https://palletsprojects.com/p/markupsafe/" binary_artifact: - url: "https://files.pythonhosted.org/packages/53/e8/601efa63c4058311a8bda7984a2fe554b9da574044967d7aee253661ee46/MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl" + url: "" hash: - value: "168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646" - algorithm: "SHA-256" + value: "" + algorithm: "" source_artifact: url: "https://files.pythonhosted.org/packages/bf/10/ff66fea6d1788c458663a84d88787bae15d45daa16f6b3ef33322a51fc7e/MarkupSafe-2.0.1.tar.gz" hash: diff --git a/plugins/package-managers/python/src/main/kotlin/Pip.kt b/plugins/package-managers/python/src/main/kotlin/Pip.kt index 18b45fb8d1120..f01bc7bff4acb 100644 --- a/plugins/package-managers/python/src/main/kotlin/Pip.kt +++ b/plugins/package-managers/python/src/main/kotlin/Pip.kt @@ -39,8 +39,8 @@ import org.ossreviewtoolkit.utils.ort.showStackTrace private const val OPTION_OPERATING_SYSTEM_DEFAULT = "linux" private val OPERATING_SYSTEMS = listOf(OPTION_OPERATING_SYSTEM_DEFAULT, "macos", "windows") -private const val OPTION_PYTHON_VERSION_DEFAULT = "3.10" -private val PYTHON_VERSIONS = listOf("2.7", "3.6", "3.7", "3.8", "3.9", OPTION_PYTHON_VERSION_DEFAULT) +private const val OPTION_PYTHON_VERSION_DEFAULT = "3.11" +private val PYTHON_VERSIONS = listOf("2.7", "3.6", "3.7", "3.8", "3.9", "3.10", OPTION_PYTHON_VERSION_DEFAULT) /** * The [PIP](https://pip.pypa.io/) package manager for Python. Also see