forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathptvsd_folder_name.py
More file actions
37 lines (26 loc) · 1.01 KB
/
ptvsd_folder_name.py
File metadata and controls
37 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import sys
import os.path
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PYTHONFILES = os.path.join(ROOT, "pythonFiles", "lib", "python")
sys.path.insert(0, PYTHONFILES)
from packaging.tags import sys_tags
sys.path.remove(PYTHONFILES)
def ptvsd_folder_name():
"""Return the folder name for the bundled PTVSD wheel compatible with the new debug adapter."""
try:
for tag in sys_tags():
folder_name = f"ptvsd-{tag.interpreter}-{tag.abi}-{tag.platform}"
folder_path = os.path.join(PYTHONFILES, folder_name)
if os.path.exists(folder_path):
print(folder_path, end="")
return
except:
# Fallback to use base PTVSD path no matter the exception.
print(PYTHONFILES, end="")
return
# Default fallback to use base PTVSD path.
print(PYTHONFILES, end="")
if __name__ == "__main__":
ptvsd_folder_name()