aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-framework/tensorflow/files/0002-Replace-distutils.sysconfig.get_python_lib-with-sysc.patch
blob: 9ce46ee217d2b143834cf10919c25a44e131057f (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 5dc007d64a9928d379851a6524a376bfdb819c6d Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Mon, 16 May 2022 00:17:02 -0700
Subject: [PATCH] Replace distutils.sysconfig.get_python_lib() with 
 sysconfig.get_path('purelib') - python 3.10 support

This is part of the effort for 51776 to get python 3.10 support.
This PR replace distutils.sysconfig.get_python_lib() with sysconfig.get_path('purelib')
as distutils has been deprecated by python 3.10.

Note sysconfig has been available since python 3.2.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

Upstream-Status: Backport from tensorflow github
[https://github.com/tensorflow/tensorflow/pull/51865]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 tensorflow/api_template.__init__.py    | 5 ++---
 tensorflow/api_template_v1.__init__.py | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/tensorflow/api_template.__init__.py b/tensorflow/api_template.__init__.py
index 1ed97439b06..58904070e62 100644
--- a/tensorflow/api_template.__init__.py
+++ b/tensorflow/api_template.__init__.py
@@ -26,7 +26,7 @@ only a placeholder to enable test cases to run. The TensorFlow build replaces
 this file with a file generated from [`api_template.__init__.py`](https://www.github.com/tensorflow/tensorflow/blob/master/tensorflow/api_template.__init__.py)
 """
 
-import distutils as _distutils
+import sysconfig as _sysconfig
 import inspect as _inspect
 import logging as _logging
 import os as _os
@@ -122,8 +122,7 @@ _site_packages_dirs += [_p for _p in _sys.path if 'site-packages' in _p]
 if 'getsitepackages' in dir(_site):
   _site_packages_dirs += _site.getsitepackages()
 
-if 'sysconfig' in dir(_distutils):
-  _site_packages_dirs += [_distutils.sysconfig.get_python_lib()]
+_site_packages_dirs += [_sysconfig.get_path('purelib')]
 
 _site_packages_dirs = list(set(_site_packages_dirs))
 
diff --git a/tensorflow/api_template_v1.__init__.py b/tensorflow/api_template_v1.__init__.py
index 87d9bc1f204..70e0fd70c34 100644
--- a/tensorflow/api_template_v1.__init__.py
+++ b/tensorflow/api_template_v1.__init__.py
@@ -14,7 +14,7 @@
 # ==============================================================================
 """Bring in all of the public TensorFlow interface into this module."""
 
-import distutils as _distutils
+import sysconfig as _sysconfig
 import inspect as _inspect
 import os as _os
 import site as _site
@@ -163,8 +163,7 @@ _site_packages_dirs += [_p for _p in _sys.path if 'site-packages' in _p]
 if 'getsitepackages' in dir(_site):
   _site_packages_dirs += _site.getsitepackages()
 
-if 'sysconfig' in dir(_distutils):
-  _site_packages_dirs += [_distutils.sysconfig.get_python_lib()]
+_site_packages_dirs += [_sysconfig.get_path('purelib')]
 
 _site_packages_dirs = list(set(_site_packages_dirs))
 
-- 
2.36.0