File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,9 +71,14 @@ def add_location(location):
7171
7272 def get_system_sitepackages ():
7373 """Get sitepackage locations from system python"""
74- system_python = sys .executable
7574
76- system_sitepackages = json .loads (
75+ python_paths = [
76+ "/usr/bin/python%s" ,
77+ "/usr/local/bin/python%s"
78+ ]
79+ path_check_count = 0
80+
81+ getsitepackages_subprocess = lambda path : json .loads (
7782 subprocess .check_output (
7883 [
7984 system_python ,
@@ -82,7 +87,17 @@ def get_system_sitepackages():
8287 ]
8388 ).decode ("utf-8" )
8489 )
85- return system_sitepackages
90+
91+ while path_check_count < len (python_paths ):
92+ try :
93+ system_python = python_paths [path_check_count ] % "." .join (
94+ [str (item ) for item in platform .python_version_tuple ()[0 :2 ]]
95+ )
96+ return getsitepackages_subprocess (system_python )
97+ except FileNotFoundError :
98+ path_check_count += 1
99+ else :
100+ return getsitepackages_subprocess (sys .executable )
86101
87102 def check_system_sitepackages ():
88103 """Try add selinux module from any of the python site-packages"""
You can’t perform that action at this time.
0 commit comments