mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/idf_tools_not_found_issue_v4.3' into 'release/v4.3'
tools: Catch OSError which is raised when the tool is not available (v4.3) See merge request espressif/esp-idf!14133
This commit is contained in:
@ -963,12 +963,15 @@ def get_python_env_path():
|
|||||||
with open(version_file_path, 'r') as version_file:
|
with open(version_file_path, 'r') as version_file:
|
||||||
idf_version_str = version_file.read()
|
idf_version_str = version_file.read()
|
||||||
else:
|
else:
|
||||||
|
idf_version_str = ''
|
||||||
try:
|
try:
|
||||||
idf_version_str = subprocess.check_output(['git', 'describe'],
|
idf_version_str = subprocess.check_output(['git', 'describe'],
|
||||||
cwd=global_idf_path, env=os.environ).decode()
|
cwd=global_idf_path, env=os.environ).decode()
|
||||||
|
except OSError:
|
||||||
|
# OSError should cover FileNotFoundError and WindowsError
|
||||||
|
warn('Git was not found')
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
warn('Git describe was unsuccessul: {}'.format(e))
|
warn('Git describe was unsuccessul: {}'.format(e.output))
|
||||||
idf_version_str = ''
|
|
||||||
match = re.match(r'^v([0-9]+\.[0-9]+).*', idf_version_str)
|
match = re.match(r'^v([0-9]+\.[0-9]+).*', idf_version_str)
|
||||||
if match:
|
if match:
|
||||||
idf_version = match.group(1)
|
idf_version = match.group(1)
|
||||||
@ -1347,7 +1350,7 @@ def action_install_python_env(args): # type: ignore
|
|||||||
if os.path.exists(virtualenv_python):
|
if os.path.exists(virtualenv_python):
|
||||||
try:
|
try:
|
||||||
subprocess.check_call([virtualenv_python, '--version'], stdout=sys.stdout, stderr=sys.stderr)
|
subprocess.check_call([virtualenv_python, '--version'], stdout=sys.stdout, stderr=sys.stderr)
|
||||||
except subprocess.CalledProcessError:
|
except (OSError, subprocess.CalledProcessError):
|
||||||
# At this point we can reinstall the virtual environment if it is non-functional. This can happen at least
|
# At this point we can reinstall the virtual environment if it is non-functional. This can happen at least
|
||||||
# when the Python interpreter was removed which was used to create the virtual environment.
|
# when the Python interpreter was removed which was used to create the virtual environment.
|
||||||
reinstall = True
|
reinstall = True
|
||||||
|
Reference in New Issue
Block a user