aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-framework/tensorflow/files/0001-distutils-is-deprecated-in-Python-3.10-cross.patch
blob: e79fc249d08c03a2a944f587b9c0017436fd3481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 79bd5c1e597ffd877822297a48d9eaa9ca3a317d Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Mon, 16 May 2022 01:18:43 -0700
Subject: [PATCH] `distutils` is deprecated in Python 3.10 #51776

The `distutils` is deprecated in Python 3.10.

As of #51776, In `python_configure.bzl`, the deprecation message will be
printed prior to the include path, causing error on return.

Use environment CROSSTOOL_PYTHON_INCLUDE_PATH to replace

Upstream-Status: Inappropriate [oe specific]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 third_party/py/python_configure.bzl | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/third_party/py/python_configure.bzl b/third_party/py/python_configure.bzl
index 300cbfb6c71..e57af9f9dc9 100644
--- a/third_party/py/python_configure.bzl
+++ b/third_party/py/python_configure.bzl
@@ -149,24 +149,7 @@ def _check_python_bin(repository_ctx, python_bin):
 
 def _get_python_include(repository_ctx, python_bin):
     """Gets the python include path."""
-    result = execute(
-        repository_ctx,
-        [
-            python_bin,
-            "-Wignore",
-            "-c",
-            "import importlib; " +
-            "import importlib.util; " +
-            "print(importlib.import_module('distutils.sysconfig').get_python_inc() " +
-            "if importlib.util.find_spec('distutils.sysconfig') " +
-            "else importlib.import_module('sysconfig').get_path('include'))",
-        ],
-        error_msg = "Problem getting python include path.",
-        error_details = ("Is the Python binary path set up right? " +
-                         "(See ./configure or " + PYTHON_BIN_PATH + ".) " +
-                         "Is distutils installed?"),
-    )
-    return result.stdout.splitlines()[0]
+    return repository_ctx.os.environ["CROSSTOOL_PYTHON_INCLUDE_PATH"]
 
 def _get_python_import_lib_name(repository_ctx, python_bin):
     """Get Python import library name (pythonXY.lib) on Windows."""
-- 
2.36.0