From 3a9ac6f10a0b4491c08a3c28bfe3c55d396b5f98 Mon Sep 17 00:00:00 2001 From: Inseob Kim Date: Tue, 19 Jul 2022 14:27:36 +0900 Subject: [PATCH] Remove dependency to distutils Because distutils is deprecated since Python 3.10. Test: atest android.security.cts.SELinuxHostTest Change-Id: I29d390dcfbeaa65b2c868bbc8648835c644e3d18 --- tests/sepolicy_tests.py | 5 +++-- tests/treble_sepolicy_tests.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/sepolicy_tests.py b/tests/sepolicy_tests.py index 79c55de9d..e940681ad 100644 --- a/tests/sepolicy_tests.py +++ b/tests/sepolicy_tests.py @@ -18,7 +18,8 @@ import os import policy import re import sys -import distutils.ccompiler + +SHARED_LIB_EXTENSION = '.dylib' if sys.platform == 'darwin' else '.so' ############################################################# # Tests @@ -158,7 +159,7 @@ if __name__ == '__main__': (options, args) = parser.parse_args() libpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), - "libsepolwrap" + distutils.ccompiler.new_compiler().shared_lib_extension) + "libsepolwrap" + SHARED_LIB_EXTENSION) if not os.path.exists(libpath): sys.exit("Error: libsepolwrap does not exist. Is this binary corrupted?\n") diff --git a/tests/treble_sepolicy_tests.py b/tests/treble_sepolicy_tests.py index a3bf661b0..64a9e950a 100644 --- a/tests/treble_sepolicy_tests.py +++ b/tests/treble_sepolicy_tests.py @@ -20,9 +20,9 @@ import policy from policy import MatchPathPrefix import re import sys -import distutils.ccompiler DEBUG=False +SHARED_LIB_EXTENSION = '.dylib' if sys.platform == 'darwin' else '.so' ''' Use file_contexts and policy to verify Treble requirements @@ -375,7 +375,7 @@ if __name__ == '__main__': parser.usage) libpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), - "libsepolwrap" + distutils.ccompiler.new_compiler().shared_lib_extension) + "libsepolwrap" + SHARED_LIB_EXTENSION) if not os.path.exists(libpath): sys.exit("Error: libsepolwrap does not exist. Is this binary corrupted?\n")