]> 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>
Thu, 6 Dec 2018 07:32:45 +0000 (08:32 +0100)
tools/check_python_dependencies.py

index d8767004b6ec57428057b2b65fffaa65423e8cf8..24ff1ac1d980031e7e9c646bb1fdf2694b6b50e5 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))