vscode-offline 0.1.2__py3-none-any.whl → 0.1.3__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.
- vscode_offline/app.py +4 -4
- vscode_offline/download.py +3 -1
- vscode_offline/utils.py +27 -6
- {vscode_offline-0.1.2.dist-info → vscode_offline-0.1.3.dist-info}/METADATA +1 -1
- vscode_offline-0.1.3.dist-info/RECORD +11 -0
- vscode_offline-0.1.2.dist-info/RECORD +0 -11
- {vscode_offline-0.1.2.dist-info → vscode_offline-0.1.3.dist-info}/WHEEL +0 -0
- {vscode_offline-0.1.2.dist-info → vscode_offline-0.1.3.dist-info}/entry_points.txt +0 -0
- {vscode_offline-0.1.2.dist-info → vscode_offline-0.1.3.dist-info}/licenses/LICENSE +0 -0
vscode_offline/app.py
CHANGED
@@ -19,7 +19,7 @@ from vscode_offline.utils import (
|
|
19
19
|
get_host_platform,
|
20
20
|
get_vscode_cli_bin,
|
21
21
|
get_vscode_commit_from_code_version,
|
22
|
-
|
22
|
+
get_vscode_commit_from_server_installer,
|
23
23
|
get_vscode_extensions_config,
|
24
24
|
get_vscode_server_home,
|
25
25
|
)
|
@@ -36,7 +36,7 @@ def cmd_download_server(args: Namespace) -> None:
|
|
36
36
|
|
37
37
|
download_vscode_server(
|
38
38
|
args.commit,
|
39
|
-
output=args.installer / f"
|
39
|
+
output=args.installer / f"server-{args.commit}",
|
40
40
|
target_platform=args.target_platform,
|
41
41
|
)
|
42
42
|
extensions_config = Path(args.extensions_config).expanduser()
|
@@ -49,7 +49,7 @@ def cmd_install_server(args: Namespace) -> None:
|
|
49
49
|
host_platform = get_host_platform()
|
50
50
|
if args.commit is None:
|
51
51
|
try:
|
52
|
-
args.commit =
|
52
|
+
args.commit = get_vscode_commit_from_server_installer(
|
53
53
|
args.installer, host_platform
|
54
54
|
)
|
55
55
|
except Exception as e:
|
@@ -59,7 +59,7 @@ def cmd_install_server(args: Namespace) -> None:
|
|
59
59
|
|
60
60
|
install_vscode_server(
|
61
61
|
args.commit,
|
62
|
-
cli_installer=args.installer / f"
|
62
|
+
cli_installer=args.installer / f"server-{args.commit}",
|
63
63
|
vscode_cli_bin=get_vscode_cli_bin(args.commit),
|
64
64
|
platform=host_platform,
|
65
65
|
)
|
vscode_offline/download.py
CHANGED
@@ -9,6 +9,8 @@ from urllib.request import urlopen
|
|
9
9
|
from vscode_offline.loggers import logger
|
10
10
|
from vscode_offline.utils import get_cli_os_arch
|
11
11
|
|
12
|
+
_CHUCK_SIZE = 4 * 1024 * 1024 # 4MiB
|
13
|
+
|
12
14
|
|
13
15
|
def _download_file(url: str, filename: str) -> None:
|
14
16
|
with urlopen(url) as resp:
|
@@ -23,7 +25,7 @@ def _download_file(url: str, filename: str) -> None:
|
|
23
25
|
|
24
26
|
with reader, open(filename, "wb") as fp:
|
25
27
|
while True:
|
26
|
-
chunk = reader.read(
|
28
|
+
chunk = reader.read(_CHUCK_SIZE)
|
27
29
|
if not chunk:
|
28
30
|
break
|
29
31
|
fp.write(chunk)
|
vscode_offline/utils.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import os
|
4
|
+
import shutil
|
4
5
|
import subprocess
|
6
|
+
import sys
|
5
7
|
from pathlib import Path
|
6
8
|
|
7
9
|
from vscode_offline.loggers import logger
|
@@ -28,8 +30,12 @@ def get_vscode_extensions_config() -> os.PathLike[str]:
|
|
28
30
|
return p # default to this path
|
29
31
|
|
30
32
|
|
31
|
-
def
|
32
|
-
|
33
|
+
def get_vscode_commit_from_server_installer(
|
34
|
+
installer: os.PathLike[str], platform: str
|
35
|
+
) -> str:
|
36
|
+
directories = list(
|
37
|
+
Path(installer).glob(f"server-*/vscode-server-{platform}.tar.gz")
|
38
|
+
)
|
33
39
|
if len(directories) > 1:
|
34
40
|
raise ValueError(
|
35
41
|
f"Multiple matching installers found in {installer} for platform {platform}"
|
@@ -39,16 +45,26 @@ def get_vscode_commit_from_installer(installer: os.PathLike[str], platform: str)
|
|
39
45
|
f"No matching installer found in {installer} for platform {platform}"
|
40
46
|
)
|
41
47
|
|
42
|
-
commit = directories[0].parent.name[len("
|
48
|
+
commit = directories[0].parent.name[len("server-") :]
|
43
49
|
logger.info(f"Getting commit from {platform} installer: {commit}")
|
44
50
|
return commit
|
45
51
|
|
46
52
|
|
47
53
|
def get_vscode_commit_from_code_version() -> str | None:
|
48
|
-
|
49
|
-
if
|
54
|
+
"""Get the current VS Code commit hash by running `code --version`.
|
55
|
+
Returns None if `code` is not found or the output is unexpected.
|
56
|
+
"""
|
57
|
+
executable = shutil.which("code")
|
58
|
+
if executable is None:
|
50
59
|
return None
|
51
|
-
|
60
|
+
proc = subprocess.run(
|
61
|
+
["code", "--version"],
|
62
|
+
executable=executable,
|
63
|
+
stdout=subprocess.PIPE,
|
64
|
+
)
|
65
|
+
if proc.returncode != 0:
|
66
|
+
return None
|
67
|
+
lines = proc.stdout.splitlines()
|
52
68
|
if len(lines) < 2:
|
53
69
|
return None # Unexpected output
|
54
70
|
|
@@ -82,6 +98,11 @@ def get_cli_os_arch(platform: str) -> str:
|
|
82
98
|
|
83
99
|
def get_host_platform() -> str:
|
84
100
|
"""Get the host platform in the format used by VS Code Server install."""
|
101
|
+
if os.name == "nt":
|
102
|
+
if "amd64" in sys.version.lower():
|
103
|
+
return "win32-x64"
|
104
|
+
raise ValueError(f"Unsupported host platform: {os.name}-{sys.version}")
|
105
|
+
|
85
106
|
(osname, _, _, _, machine) = os.uname()
|
86
107
|
|
87
108
|
if osname.lower() == "linux":
|
@@ -0,0 +1,11 @@
|
|
1
|
+
vscode_offline/__init__.py,sha256=dr6Jtj0XT9eQEC4fzNigEYsAIEfCsaom3HDbUsS-2O4,57
|
2
|
+
vscode_offline/app.py,sha256=MLYg_2q3pudTL0zBAWTRSjVM_8zDccLIZt0s00xvT7Q,5686
|
3
|
+
vscode_offline/download.py,sha256=hImUW23npX0hgNMcJ2E3nRLbW8fvzeIFEovg0mWzm9U,3763
|
4
|
+
vscode_offline/install.py,sha256=UNgLnMAAZEOtX4s8v6QlmuIHPf3aeuXrCWfC6_TEM-0,3488
|
5
|
+
vscode_offline/loggers.py,sha256=vX91NMtNo1xfxq5y4BCtm_uhCTKtCODqBJHNvcT7JdQ,104
|
6
|
+
vscode_offline/utils.py,sha256=XknMz1aBMyyTvWG-szE_0eMG3KOdpl9aAeX3E5BrDAI,3542
|
7
|
+
vscode_offline-0.1.3.dist-info/licenses/LICENSE,sha256=pUIXFkLeTS986b7dopOVLyuw72fJsUxhl8H3rEMIycA,1053
|
8
|
+
vscode_offline-0.1.3.dist-info/WHEEL,sha256=-neZj6nU9KAMg2CnCY6T3w8J53nx1kFGw_9HfoSzM60,79
|
9
|
+
vscode_offline-0.1.3.dist-info/entry_points.txt,sha256=zIMeh_ENKKzlt9lDao8icofSI0TeCQxH8eCwxIRI2G8,56
|
10
|
+
vscode_offline-0.1.3.dist-info/METADATA,sha256=hjeP62mRkggLHpIypE8RgSNXUceC9PYGYBWCrhvabak,2492
|
11
|
+
vscode_offline-0.1.3.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
vscode_offline/__init__.py,sha256=dr6Jtj0XT9eQEC4fzNigEYsAIEfCsaom3HDbUsS-2O4,57
|
2
|
-
vscode_offline/app.py,sha256=CQbc8dFATwXV2VqSZGJAquTIe7sjae3ZGlmoQSllB-I,5666
|
3
|
-
vscode_offline/download.py,sha256=R7VjdqbMZ1NLOrDF6OEhMDWCHY1MaprqALX7M_UD3Uo,3717
|
4
|
-
vscode_offline/install.py,sha256=UNgLnMAAZEOtX4s8v6QlmuIHPf3aeuXrCWfC6_TEM-0,3488
|
5
|
-
vscode_offline/loggers.py,sha256=vX91NMtNo1xfxq5y4BCtm_uhCTKtCODqBJHNvcT7JdQ,104
|
6
|
-
vscode_offline/utils.py,sha256=tI1gktyhkRiTfBaELsNNTa6Fk4y5hyAtoebERfsyxS4,3014
|
7
|
-
vscode_offline-0.1.2.dist-info/licenses/LICENSE,sha256=pUIXFkLeTS986b7dopOVLyuw72fJsUxhl8H3rEMIycA,1053
|
8
|
-
vscode_offline-0.1.2.dist-info/WHEEL,sha256=-neZj6nU9KAMg2CnCY6T3w8J53nx1kFGw_9HfoSzM60,79
|
9
|
-
vscode_offline-0.1.2.dist-info/entry_points.txt,sha256=zIMeh_ENKKzlt9lDao8icofSI0TeCQxH8eCwxIRI2G8,56
|
10
|
-
vscode_offline-0.1.2.dist-info/METADATA,sha256=PlAToQnUc7dJrK1iuHRUajFY5Gm__yBOb4Wj2J3Gv9E,2492
|
11
|
-
vscode_offline-0.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|