tools: correct printed path on MS Win
This commit is contained in:
parent
7458c1c1e2
commit
98bc172f58
1 changed files with 9 additions and 2 deletions
|
@ -25,13 +25,20 @@ except:
|
||||||
'setting up the required packages.')
|
'setting up the required packages.')
|
||||||
sys.exit(1)
|
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__":
|
if __name__ == "__main__":
|
||||||
idf_path = os.getenv("IDF_PATH")
|
idf_path = os.getenv("IDF_PATH")
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='ESP32 Python package dependency checker')
|
parser = argparse.ArgumentParser(description='ESP32 Python package dependency checker')
|
||||||
parser.add_argument('--requirements', '-r',
|
parser.add_argument('--requirements', '-r',
|
||||||
help='Path to the requrements file',
|
help='Path to the requrements file',
|
||||||
default=idf_path + '/requirements.txt')
|
default=os.path.join(idf_path, 'requirements.txt'))
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Special case for MINGW32 Python, needs some packages
|
# Special case for MINGW32 Python, needs some packages
|
||||||
|
@ -70,7 +77,7 @@ if __name__ == "__main__":
|
||||||
print(requirement)
|
print(requirement)
|
||||||
print('Please refer to the Get Started section of the ESP-IDF Programming Guide for setting up the required '
|
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.'
|
'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)
|
sys.exit(1)
|
||||||
|
|
||||||
print('Python requirements from {} are satisfied.'.format(args.requirements))
|
print('Python requirements from {} are satisfied.'.format(args.requirements))
|
||||||
|
|
Loading…
Reference in a new issue