File tree Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ def python():
9090 % (platform .python_version (), util .get_pythonexe_path ()),
9191 fg = "green" ,
9292 )
93- except (exception .IncompatiblePythonError , exception .DistutilsNotFound ) as e :
93+ except (exception .IncompatiblePythonError , exception .PythonVenvModuleNotFound ) as e :
9494 raise click .ClickException (
9595 "The Python %s (%s) interpreter is not compatible.\n Reason: %s"
9696 % (platform .python_version (), util .get_pythonexe_path (), str (e ))
@@ -123,7 +123,7 @@ def core_check(ctx, **kwargs):
123123 % (state .get ("core_version" ), state .get ("platformio_exe" )),
124124 fg = "green" ,
125125 )
126- except ( exception .InvalidPlatformIOCore ) as e :
126+ except exception .InvalidPlatformIOCore as e :
127127 raise click .ClickException (
128128 "Compatible PlatformIO Core not found.\n Reason: %s" % str (e )
129129 )
Original file line number Diff line number Diff line change 1414
1515
1616class PIOInstallerException (Exception ):
17-
1817 MESSAGE = None
1918
2019 def __str__ (self ): # pragma: no cover
@@ -26,15 +25,12 @@ def __str__(self): # pragma: no cover
2625
2726
2827class IncompatiblePythonError (PIOInstallerException ):
29-
3028 MESSAGE = "{0}"
3129
3230
33- class DistutilsNotFound (PIOInstallerException ):
34-
35- MESSAGE = "Could not find distutils module"
31+ class PythonVenvModuleNotFound (PIOInstallerException ):
32+ MESSAGE = "Could not find Python `venv` module"
3633
3734
3835class InvalidPlatformIOCore (PIOInstallerException ):
39-
4036 MESSAGE = "{0}"
Original file line number Diff line number Diff line change @@ -138,9 +138,10 @@ def check():
138138 raise exception .IncompatiblePythonError ("Conda is not supported" )
139139
140140 try :
141- __import__ ("distutils.command" )
141+ __import__ ("venv" )
142+ # __import__("distutils.command")
142143 except ImportError :
143- raise exception .DistutilsNotFound ()
144+ raise exception .PythonVenvModuleNotFound ()
144145
145146 # portable Python 3 for macOS is not compatible with macOS < 10.13
146147 # https://github.com/platformio/platformio-core-installer/issues/70
@@ -224,10 +225,10 @@ def find_compatible_pythons(
224225 log .debug (error )
225226 except UnicodeDecodeError :
226227 pass
227- if error and "Could not find distutils module" in error :
228+ if error and "`venv` module" in error :
228229 # pylint:disable=line-too-long
229230 raise click .ClickException (
230- """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.
231232Please install this package manually using the OS package manager. For example:
232233
233234$ apt-get install python3-venv
You can’t perform that action at this time.
0 commit comments