FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
techscript/python-installer/techscript/launcher.py at main · Tcode-Motion/techscript · GitHub
Tcode-Motion
/
techscript
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
7
Code
Issues
0
Pull requests
0
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
techscript
/
python-installer
/
techscript
/
launcher.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (36 loc) · 1.3 KB
Breadcrumbs
techscript
/
python-installer
/
techscript
/
launcher.py
Copy path
File metadata and controls
43 lines (36 loc) · 1.3 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
"""
TechScript launcher module.
Used to forward `tsc` commands when invoked through `python -m techscript run`.
"""
import
os
import
shutil
import
subprocess
import
sys
def
find_tsc
()
->
str
:
"""Find the tsc binary or raise an error."""
tsc
=
shutil
.
which
(
"tsc"
)
if
not
tsc
:
# Also check the default install locations explicitly
candidates
=
[]
local_app
=
os
.
environ
.
get
(
"LOCALAPPDATA"
,
""
)
if
local_app
:
candidates
.
append
(
os
.
path
.
join
(
local_app
,
"TechScript"
,
"bin"
,
"tsc.exe"
))
candidates
.
append
(
os
.
path
.
expanduser
(
"~/.local/bin/tsc"
))
prefix
=
os
.
environ
.
get
(
"PREFIX"
,
""
)
if
prefix
:
candidates
.
append
(
os
.
path
.
join
(
prefix
,
"bin"
,
"tsc"
))
for
path
in
candidates
:
if
os
.
path
.
isfile
(
path
)
and
os
.
access
(
path
,
os
.
X_OK
):
return
path
print
(
"
\n
✘ TechScript compiler (tsc) is not installed or not found in PATH."
,
file
=
sys
.
stderr
)
print
(
" Run: techscript install"
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
return
tsc
def
launch
(
args
:
list
)
->
int
:
"""Forward args to the tsc binary and return the exit code."""
tsc
=
find_tsc
()
try
:
result
=
subprocess
.
run
([
tsc
]
+
args
)
return
result
.
returncode
except
KeyboardInterrupt
:
return
130
Back
|
FazBrowse Home
|
New Git URL