]> granicus.if.org Git - esp-idf/commitdiff
tools: correct printed path on MS Win
authorRoland Dobai <dobai.roland@gmail.com>
Fri, 30 Nov 2018 12:22:31 +0000 (13:22 +0100)
committerRoland Dobai <dobai.roland@gmail.com>
Fri, 30 Nov 2018 12:43:28 +0000 (13:43 +0100)
tools/check_python_dependencies.py

index f68f887e9cb4ae73e5caa6cf48fa01a52df24fa0..396d52cc90851ff69feca02b16e76d36daf49c20 100755 (executable)
@@ -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))