addftool 0.2.15__py3-none-any.whl → 0.2.16__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- addftool/deploy/vscode_server.py +38 -25
- {addftool-0.2.15.dist-info → addftool-0.2.16.dist-info}/METADATA +1 -1
- {addftool-0.2.15.dist-info → addftool-0.2.16.dist-info}/RECORD +6 -6
- {addftool-0.2.15.dist-info → addftool-0.2.16.dist-info}/WHEEL +1 -1
- {addftool-0.2.15.dist-info → addftool-0.2.16.dist-info}/entry_points.txt +0 -0
- {addftool-0.2.15.dist-info → addftool-0.2.16.dist-info}/top_level.txt +0 -0
addftool/deploy/vscode_server.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from addftool.util import need_sudo, execute_command, install_packages
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def deploy_vscode_server(install_tunnel=True):
|
|
4
|
+
def deploy_vscode_server(install_tunnel=True, install_method="wget"):
|
|
5
5
|
"""
|
|
6
6
|
Deploy Visual Studio Code and optionally start VS Code Tunnel.
|
|
7
7
|
|
|
@@ -9,29 +9,40 @@ def deploy_vscode_server(install_tunnel=True):
|
|
|
9
9
|
install_tunnel (bool): Whether to start VS Code Tunnel after installation
|
|
10
10
|
"""
|
|
11
11
|
command_prefix = "sudo " if need_sudo() else ""
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
if install_method == "apt":
|
|
13
|
+
# Install prerequisites
|
|
14
|
+
print("Installing prerequisites...")
|
|
15
|
+
execute_command(command_prefix + "apt-get install -y wget gpg")
|
|
16
|
+
|
|
17
|
+
# Add Microsoft's GPG key
|
|
18
|
+
print("Adding Microsoft's GPG key...")
|
|
19
|
+
execute_command("wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg")
|
|
20
|
+
execute_command(command_prefix + "install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg")
|
|
21
|
+
|
|
22
|
+
# Add VS Code repository
|
|
23
|
+
print("Adding VS Code repository...")
|
|
24
|
+
execute_command(command_prefix + "sh -c 'echo \"deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] "
|
|
25
|
+
"https://packages.microsoft.com/repos/code stable main\" > /etc/apt/sources.list.d/vscode.list'")
|
|
26
|
+
|
|
27
|
+
# Clean up
|
|
28
|
+
execute_command("rm -f packages.microsoft.gpg")
|
|
29
|
+
|
|
30
|
+
# Install VS Code
|
|
31
|
+
print("Installing VS Code...")
|
|
32
|
+
execute_command(command_prefix + "apt install -y apt-transport-https")
|
|
33
|
+
execute_command(command_prefix + "apt update")
|
|
34
|
+
execute_command(command_prefix + "apt install -y code")
|
|
35
|
+
else:
|
|
36
|
+
# check if wget is installed
|
|
37
|
+
print("Checking if wget is installed...")
|
|
38
|
+
install_packages(["wget"])
|
|
39
|
+
# wget https://go.microsoft.com/fwlink/?LinkID=760868 -O /tmp/vscode-server.deb
|
|
40
|
+
# sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-downgrades /tmp/vscode-server.deb
|
|
41
|
+
print("Downloading VS Code .deb package...")
|
|
42
|
+
execute_command("wget https://go.microsoft.com/fwlink/?LinkID=760868 -O /tmp/vscode-server.deb")
|
|
43
|
+
print("Installing VS Code from .deb package...")
|
|
44
|
+
execute_command(command_prefix + "DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-downgrades /tmp/vscode-server.deb")
|
|
45
|
+
execute_command("rm -f /tmp/vscode-server.deb")
|
|
35
46
|
|
|
36
47
|
# Start VS Code Tunnel if requested
|
|
37
48
|
if install_tunnel:
|
|
@@ -50,6 +61,8 @@ def add_deploy_vscode_server_args(parser):
|
|
|
50
61
|
"""
|
|
51
62
|
parser.add_argument("--no-tunnel", dest="install_tunnel", action="store_false",
|
|
52
63
|
help="Skip starting VS Code Tunnel after installation")
|
|
64
|
+
parser.add_argument("--install_method", type=str, default="wget", choices=["apt", "wget"],
|
|
65
|
+
help="Method to install VS Code (default: wget)")
|
|
53
66
|
parser.set_defaults(install_tunnel=True)
|
|
54
67
|
|
|
55
68
|
|
|
@@ -60,7 +73,7 @@ def deploy_vscode_server_main(args):
|
|
|
60
73
|
Args:
|
|
61
74
|
args: Parsed command-line arguments
|
|
62
75
|
"""
|
|
63
|
-
deploy_vscode_server(install_tunnel=args.install_tunnel)
|
|
76
|
+
deploy_vscode_server(install_tunnel=args.install_tunnel, install_method=args.install_method)
|
|
64
77
|
|
|
65
78
|
|
|
66
79
|
if __name__ == "__main__":
|
|
@@ -9,12 +9,12 @@ addftool/util.py,sha256=zlNLu8Be8cGIpNRqBw8_0q7nFxWlsJ9cToN62ohjdXE,2335
|
|
|
9
9
|
addftool/deploy/__init__.py,sha256=UL8b-Idt7lStlMiOm8oTZ65fdzYz99Fgzq2Gaw8WsZc,1544
|
|
10
10
|
addftool/deploy/azure.py,sha256=_o_9Eh8cVwLDAqvfyRYBtQRHs_Gul-nCs2ZXttwO1bk,1301
|
|
11
11
|
addftool/deploy/ssh_server.py,sha256=7glpJJNROskpqPkeYrTc2MbVzRendUZLv-ZgPs6HCq8,5641
|
|
12
|
-
addftool/deploy/vscode_server.py,sha256=
|
|
12
|
+
addftool/deploy/vscode_server.py,sha256=VNH4i5PTa1FH2Yk1S95fNCJEzwe380GAj5vc-h7cdWk,3740
|
|
13
13
|
addftool/process/__init__.py,sha256=Dze8OrcyjQlAbPrjE_h8bMi8W4b3OJyZOjTucPrkJvM,3721
|
|
14
14
|
addftool/process/utils.py,sha256=JldxnwanLJOgxaPgmCJh7SeBRaaj5rFxWWxh1hpsvbA,2609
|
|
15
15
|
addftool/ssh/__init__.py,sha256=h5_rCO0A6q2Yw9vFguQZZp_ApAJsT1dcnKnbKKZ0cDM,4409
|
|
16
|
-
addftool-0.2.
|
|
17
|
-
addftool-0.2.
|
|
18
|
-
addftool-0.2.
|
|
19
|
-
addftool-0.2.
|
|
20
|
-
addftool-0.2.
|
|
16
|
+
addftool-0.2.16.dist-info/METADATA,sha256=7nrWr3OjjsF48YajTsvjLi_MXJbf1zUBXfifVu-RYP8,221
|
|
17
|
+
addftool-0.2.16.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
18
|
+
addftool-0.2.16.dist-info/entry_points.txt,sha256=9lkmuWMInwUAtev8w8poNkNd7iML9Bjd5CBCFVxg2b8,111
|
|
19
|
+
addftool-0.2.16.dist-info/top_level.txt,sha256=jqj56-plrBbyzY0tIxB6wPzjAA8kte4hUlajyyQygN4,9
|
|
20
|
+
addftool-0.2.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|