From 09dd8ca3e9071d3f3b785289b8b0652242004765 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 Nov 2019 16:17:30 +0100 Subject: [PATCH 1/3] idf_tools.py: when guessing IDF_PATH, set it in the enviroment This allows the processes launched from idf_tools.py to use the value of IDF_PATH. One such example is the installation of Python packages, when requirements.txt uses IDF_PATH to refer to the esp-windows-curses package. Closes https://github.com/espressif/esp-idf/issues/4341 --- tools/idf_tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 158b5a7648..163d934b7c 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -1339,6 +1339,7 @@ def main(argv): global_idf_path = args.idf_path if not global_idf_path: global_idf_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..")) + os.environ['IDF_PATH'] = global_idf_path global global_idf_tools_path global_idf_tools_path = os.environ.get('IDF_TOOLS_PATH') or os.path.expanduser(IDF_TOOLS_PATH_DEFAULT) From 5ab36dc2ec41476995314b14902f6ef92af6be14 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 30 Oct 2019 16:19:17 +0100 Subject: [PATCH 2/3] idf_tools.py: fix virtualenv issue for macOS with homebrew --- tools/idf_tools.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 163d934b7c..3821c8d7ae 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -1344,6 +1344,11 @@ def main(argv): global global_idf_tools_path global_idf_tools_path = os.environ.get('IDF_TOOLS_PATH') or os.path.expanduser(IDF_TOOLS_PATH_DEFAULT) + # On macOS, unset __PYVENV_LAUNCHER__ variable if it is set. + # Otherwise sys.executable keeps pointing to the system Python, even when a python binary from a virtualenv is invoked. + # See https://bugs.python.org/issue22490#msg283859. + os.environ.pop('__PYVENV_LAUNCER__', None) + if sys.version_info.major == 2: try: global_idf_tools_path.decode('ascii') From 97242031e70a5e8fad4d8fe7918b77923a89217d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 21 Jan 2020 10:48:24 +0100 Subject: [PATCH 3/3] idf_tools.py: fix typo in __PYVENV_LAUNCHER__ env variable name Fixes the workaround added in 9279b72a6. --- tools/idf_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 3821c8d7ae..6a4674da62 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -1347,7 +1347,7 @@ def main(argv): # On macOS, unset __PYVENV_LAUNCHER__ variable if it is set. # Otherwise sys.executable keeps pointing to the system Python, even when a python binary from a virtualenv is invoked. # See https://bugs.python.org/issue22490#msg283859. - os.environ.pop('__PYVENV_LAUNCER__', None) + os.environ.pop('__PYVENV_LAUNCHER__', None) if sys.version_info.major == 2: try: