@@ -96,7 +96,8 @@ def get_portable_python_url():
9696 systype = util .get_systype ()
9797 result = requests .get (
9898 "https://api.registry.platformio.org/v3/packages/"
99- "platformio/tool/python-portable"
99+ "platformio/tool/python-portable" ,
100+ timeout = 10 ,
100101 ).json ()
101102 versions = [
102103 version
@@ -137,9 +138,10 @@ def check():
137138 raise exception .IncompatiblePythonError ("Conda is not supported" )
138139
139140 try :
140- __import__ ("distutils.command" )
141+ __import__ ("venv" )
142+ # __import__("distutils.command")
141143 except ImportError :
142- raise exception .DistutilsNotFound ()
144+ raise exception .PythonVenvModuleNotFound ()
143145
144146 # portable Python 3 for macOS is not compatible with macOS < 10.13
145147 # https://github.com/platformio/platformio-core-installer/issues/70
@@ -175,7 +177,15 @@ def find_compatible_pythons(
175177 ignore_list = []
176178 for p in ignore_pythons or []:
177179 ignore_list .extend (glob .glob (p ))
178- exenames = ["python3" , "python" ]
180+ exenames = [
181+ # "python3.11",
182+ "python3.10" ,
183+ "python3.9" ,
184+ "python3.8" ,
185+ "python3.7" ,
186+ "python3" ,
187+ "python" ,
188+ ]
179189 if util .IS_WINDOWS :
180190 exenames = ["%s.exe" % item for item in exenames ]
181191 log .debug ("Current environment PATH %s" , os .getenv ("PATH" ))
@@ -215,10 +225,10 @@ def find_compatible_pythons(
215225 log .debug (error )
216226 except UnicodeDecodeError :
217227 pass
218- if error and "Could not find distutils module" in error :
228+ if error and "`venv` module" in error :
219229 # pylint:disable=line-too-long
220230 raise click .ClickException (
221- """Can not install PlatformIO Core due to a missed `distutils` package in your Python installation.
231+ """Can not install PlatformIO Core due to a missed `venv` module in your Python installation.
222232Please install this package manually using the OS package manager. For example:
223233
224234$ apt-get install python3-venv
0 commit comments