Remove dependency to distutils am: 42d563bb62 am: d88a872f43

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/sepolicy/+/19395374

Change-Id: I6c8d426af42457af549e6742306a1c0a309f1e69
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/tests/sepolicy_tests.py b/tests/sepolicy_tests.py
index 79c55de..e940681 100644
--- a/tests/sepolicy_tests.py
+++ b/tests/sepolicy_tests.py
@@ -18,7 +18,8 @@
 import policy
 import re
 import sys
-import distutils.ccompiler
+
+SHARED_LIB_EXTENSION = '.dylib' if sys.platform == 'darwin' else '.so'
 
 #############################################################
 # Tests
@@ -158,7 +159,7 @@
     (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 a3bf661..64a9e95 100644
--- a/tests/treble_sepolicy_tests.py
+++ b/tests/treble_sepolicy_tests.py
@@ -20,9 +20,9 @@
 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 @@
                     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")