mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
Tools: Allow custom Python installation path with IDF_PYTHON_ENV_PATH
IDF_PYTHON_ENV_PATH is the path where the Python environment is created and used. By default it is inside IDF_TOOLS_PATH. IDF_PYTHON_ENV_PATH was exported by idf_tools.py but was not imported back. This fixes the issue and ESP-IDF will honor the value of IDF_PYTHON_ENV_PATH. Closes https://github.com/espressif/esp-idf/issues/10489
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import inspect
|
||||
@@ -6,6 +6,7 @@ import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from typing import List
|
||||
|
||||
@@ -80,5 +81,25 @@ class TestPythonInstall(unittest.TestCase):
|
||||
self.assertIn(REQ_CORE, output)
|
||||
|
||||
|
||||
class TestCustomPythonPathInstall(TestPythonInstall):
|
||||
|
||||
def setUp(self): # type: () -> None
|
||||
self.CUSTOM_PYTHON_DIR = tempfile.mkdtemp()
|
||||
self.addCleanup(shutil.rmtree, self.CUSTOM_PYTHON_DIR)
|
||||
os.environ['IDF_PYTHON_ENV_PATH'] = self.CUSTOM_PYTHON_DIR
|
||||
|
||||
def test_default_arguments(self): # type: () -> None
|
||||
output = self.run_idf_tools(['check-python-dependencies'])
|
||||
self.assertIn(f"{self.CUSTOM_PYTHON_DIR}/bin/python doesn't exist", output)
|
||||
self.assertNotIn(PYTHON_DIR, output)
|
||||
|
||||
output = self.run_idf_tools(['install-python-env'])
|
||||
self.assertIn(self.CUSTOM_PYTHON_DIR, output)
|
||||
self.assertNotIn(PYTHON_DIR, output)
|
||||
|
||||
output = self.run_idf_tools(['check-python-dependencies'])
|
||||
self.assertIn(self.CUSTOM_PYTHON_DIR, output)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user