From 98bc172f58a47251e5509ae4b6fc092c24ecad28 Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Fri, 30 Nov 2018 13:22:31 +0100 Subject: [PATCH] tools: correct printed path on MS Win --- tools/check_python_dependencies.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/check_python_dependencies.py b/tools/check_python_dependencies.py index f68f887e9..396d52cc9 100755 --- a/tools/check_python_dependencies.py +++ b/tools/check_python_dependencies.py @@ -25,13 +25,20 @@ except: 'setting up the required packages.') sys.exit(1) +def escape_backslash(path): + if sys.platform == "win32": + # escaped backslashes are necessary in order to be able to copy-paste the printed path + return path.replace("\\", "\\\\") + else: + return path + if __name__ == "__main__": idf_path = os.getenv("IDF_PATH") parser = argparse.ArgumentParser(description='ESP32 Python package dependency checker') parser.add_argument('--requirements', '-r', help='Path to the requrements file', - default=idf_path + '/requirements.txt') + default=os.path.join(idf_path, 'requirements.txt')) args = parser.parse_args() # Special case for MINGW32 Python, needs some packages @@ -70,7 +77,7 @@ if __name__ == "__main__": print(requirement) print('Please refer to the Get Started section of the ESP-IDF Programming Guide for setting up the required ' 'packages. Alternatively, you can run "{} -m pip install --user -r {}" for resolving the issue.' - ''.format(sys.executable, args.requirements)) + ''.format(escape_backslash(sys.executable), escape_backslash(args.requirements))) sys.exit(1) print('Python requirements from {} are satisfied.'.format(args.requirements))