Skip to content

Commit

Permalink
Merge branch 'release/v1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jul 28, 2023
2 parents f8e30a0 + 5d799b0 commit 923523d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
2 changes: 1 addition & 1 deletion get-platformio.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pioinstaller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import logging.config

VERSION = (1, 2, 0)
VERSION = (1, 2, 1)
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "platformio-installer"
Expand Down
38 changes: 23 additions & 15 deletions pioinstaller/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ def find_compatible_pythons(
for p in ignore_pythons or []:
ignore_list.extend(glob.glob(p))
exenames = [
# "python3.11",
"python3", # system Python
"python3.11",
"python3.10",
"python3.9",
"python3.8",
"python3.7",
"python3",
"python",
]
if util.IS_WINDOWS:
Expand All @@ -196,9 +196,14 @@ def find_compatible_pythons(
if not os.path.isfile(os.path.join(path, exe)):
continue
candidates.append(os.path.join(path, exe))
if sys.executable not in candidates:
candidates.insert(0, sys.executable)

if sys.executable in candidates:
candidates.remove(sys.executable)
# put current Python to the top of list
candidates.insert(0, sys.executable)

result = []
missed_venv_module = False
for item in candidates:
if item in ignore_list:
continue
Expand All @@ -220,26 +225,29 @@ def find_compatible_pythons(
except UnicodeDecodeError:
pass
except subprocess.CalledProcessError as e:
error = None
try:
error = e.output.decode()
if error and "`venv` module" in error:
missed_venv_module = True
log.debug(error)
except UnicodeDecodeError:
pass
if error and "`venv` module" in error:
# pylint:disable=line-too-long
raise click.ClickException(
"""Can not install PlatformIO Core due to a missed `venv` module in your Python installation.
Please install this package manually using the OS package manager. For example:
$ apt-get install python3-venv
(MAY require administrator access `sudo`)""",
)
except Exception as e: # pylint: disable=broad-except
log.debug(e)

if not result and raise_exception:
if missed_venv_module:
# pylint:disable=line-too-long
raise click.ClickException(
"""Can not install PlatformIO Core due to a missed `venv` module in your Python installation.
Please install this package manually using the OS package manager. For example:
$ apt-get install python3.%d-venv
(MAY require administrator access `sudo`)"""
% (sys.version_info[1]),
)

raise exception.IncompatiblePythonError(
"Could not find compatible Python 3.6 or above in your system."
"Please install the latest official Python 3 and restart installation:\n"
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"requests==2.31.0",
"colorama==0.4.6",
"semantic-version==2.8.5", # >2.8.5 does not support Python 3.6
"certifi==2023.5.7",
"certifi==2023.7.22",
# Misc
"wheel==0.40.0",
"wheel==0.41.0",
],
packages=find_packages(),
entry_points={
Expand Down

0 comments on commit 923523d

Please sign in to comment.