FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
vscode-python/pythonFiles/ptvsd_folder_name.py at jimgries/issue-titles · iserko/vscode-python · GitHub
iserko
/
vscode-python
Public
forked from
microsoft/vscode-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
vscode-python
/
pythonFiles
/
ptvsd_folder_name.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (41 loc) · 1.6 KB
Breadcrumbs
vscode-python
/
pythonFiles
/
ptvsd_folder_name.py
Copy path
File metadata and controls
53 lines (41 loc) · 1.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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"
)
REQUIREMENTS
=
os
.
path
.
join
(
ROOT
,
"requirements.txt"
)
sys
.
path
.
insert
(
0
,
PYTHONFILES
)
from
packaging
.
requirements
import
Requirement
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."""
with
open
(
REQUIREMENTS
,
"r"
,
encoding
=
"utf-8"
)
as
reqsfile
:
for
line
in
reqsfile
:
pkgreq
=
Requirement
(
line
)
if
pkgreq
.
name
==
"ptvsd"
:
specs
=
pkgreq
.
specifier
try
:
spec
,
=
specs
version
=
spec
.
version
except
:
# Fallpack to use base PTVSD path.
print
(
PYTHONFILES
,
end
=
""
)
return
break
try
:
for
tag
in
sys_tags
():
folder_name
=
f"ptvsd-
{
version
}
-
{
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
()
Back
|
FazBrowse Home
|
New Git URL