From c7209b110ecb7669e3ee44d695a24aba64b87d01 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 3 Feb 2020 18:05:53 +1100 Subject: [PATCH] check_python_dependencies: If overriding requirements.txt path, provide a pip command line Advice about install.sh/install.bat, etc only works for the default requirements.txt --- tools/check_python_dependencies.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/check_python_dependencies.py b/tools/check_python_dependencies.py index 103d98d10f..bb1d15765d 100755 --- a/tools/check_python_dependencies.py +++ b/tools/check_python_dependencies.py @@ -39,10 +39,12 @@ def escape_backslash(path): if __name__ == "__main__": idf_path = os.getenv("IDF_PATH") + default_requirements_path = os.path.join(idf_path, 'requirements.txt') + parser = argparse.ArgumentParser(description='ESP32 Python package dependency checker') parser.add_argument('--requirements', '-r', help='Path to the requrements file', - default=os.path.join(idf_path, 'requirements.txt')) + default=default_requirements_path) args = parser.parse_args() not_satisfied = [] @@ -64,7 +66,10 @@ if __name__ == "__main__": print('The following Python requirements are not satisfied:') for requirement in not_satisfied: print(requirement) - if os.environ.get('IDF_PYTHON_ENV_PATH'): + if os.path.realpath(args.requirements) != os.path.realpath(default_requirements_path): + # we're using this script to check non-default requirements.txt, so tell the user to run pip + print('Please check the documentation for the feature you are using, or run "%s -m pip install -r %s"' % (sys.executable, args.requirements)) + elif os.environ.get('IDF_PYTHON_ENV_PATH'): # We are running inside a private virtual environment under IDF_TOOLS_PATH, # ask the user to run install.bat again. if sys.platform == "win32" and not os.environ.get("MSYSTEM"):