FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql-action/python-setup/tests/from_python_exe.py at main · lvyinggithub/codeql-action · GitHub
lvyinggithub
/
codeql-action
Public
forked from
github/codeql-action
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
12
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql-action
/
python-setup
/
tests
/
from_python_exe.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
35 lines (27 loc) · 1.17 KB
Breadcrumbs
codeql-action
/
python-setup
/
tests
/
from_python_exe.py
Copy path
File metadata and controls
executable file
·
35 lines (27 loc) · 1.17 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
#!/usr/bin/env python3
import
sys
import
os
import
subprocess
from
typing
import
Tuple
def
get_details
(
path_to_python_exe
:
str
)
->
Tuple
[
str
,
str
]:
import_path
=
subprocess
.
check_output
(
[
path_to_python_exe
,
"-c"
,
"import os; import pip; print(os.path.dirname(os.path.dirname(pip.__file__)))"
,
],
stdin
=
subprocess
.
DEVNULL
,
)
version
=
subprocess
.
check_output
(
[
path_to_python_exe
,
"-c"
,
"import sys; print(sys.version_info[0])"
],
stdin
=
subprocess
.
DEVNULL
,
)
return
version
.
decode
(
"utf-8"
).
strip
(),
import_path
.
decode
(
"utf-8"
).
strip
()
if
__name__
==
"__main__"
:
version
,
import_path
=
get_details
(
sys
.
argv
[
1
])
# see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
env_file
=
open
(
os
.
environ
[
"GITHUB_ENV"
],
mode
=
"at"
)
print
(
"Setting LGTM_PYTHON_SETUP_VERSION={}"
.
format
(
version
))
print
(
"LGTM_PYTHON_SETUP_VERSION={}"
.
format
(
version
),
file
=
env_file
)
print
(
"Setting LGTM_INDEX_IMPORT_PATH={}"
.
format
(
import_path
))
print
(
"LGTM_INDEX_IMPORT_PATH={}"
.
format
(
import_path
),
file
=
env_file
)
Back
|
FazBrowse Home
|
New Git URL