vscode-offline 0.1.7__tar.gz → 0.1.8__tar.gz
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-0.1.7 → vscode_offline-0.1.8}/PKG-INFO +2 -2
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/README.md +1 -1
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/src/vscode_offline/_version.py +2 -2
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/src/vscode_offline/app.py +5 -5
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/src/vscode_offline/download.py +3 -2
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/src/vscode_offline/utils.py +3 -5
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/tests/test_utils.py +42 -1
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/.editorconfig +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/.github/workflows/build.yml +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/.gitignore +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/.python-version +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/.vscode/extensions.json +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/.vscode/settings.json +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/LICENSE +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/lefthook.yml +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/pyproject.toml +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/pyrightconfig.json +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/src/vscode_offline/__init__.py +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/src/vscode_offline/install.py +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/src/vscode_offline/loggers.py +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/src/vscode_offline/py.typed +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/tests/test_install.py +0 -0
- {vscode_offline-0.1.7 → vscode_offline-0.1.8}/uv.lock +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: vscode-offline
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.8
|
4
4
|
Summary: Download and install VS Code for offline environments
|
5
5
|
Project-URL: Homepage, https://github.com/fanck0605/vscode-offline
|
6
6
|
Author-email: Chuck Fan <fanck0605@qq.com>
|
@@ -51,7 +51,7 @@ pip install -U vscode-offline
|
|
51
51
|
vscode-offline download-all --client-platform win32-x64 --server-platform linux-x64
|
52
52
|
```
|
53
53
|
|
54
|
-
(3)复制 `./vscode-offline-installer` 到内网 Windows 机器,安装
|
54
|
+
(3)复制 `./vscode-offline-installer` 到内网 Windows 机器,安装 `./vscode-offline-installer/<version>` 下的 VS Code,然后执行如下命令安装所有插件
|
55
55
|
|
56
56
|
```shell
|
57
57
|
vscode-offline install-extensions --installer ./vscode-offline-installer
|
@@ -28,7 +28,7 @@ pip install -U vscode-offline
|
|
28
28
|
vscode-offline download-all --client-platform win32-x64 --server-platform linux-x64
|
29
29
|
```
|
30
30
|
|
31
|
-
(3)复制 `./vscode-offline-installer` 到内网 Windows 机器,安装
|
31
|
+
(3)复制 `./vscode-offline-installer` 到内网 Windows 机器,安装 `./vscode-offline-installer/<version>` 下的 VS Code,然后执行如下命令安装所有插件
|
32
32
|
|
33
33
|
```shell
|
34
34
|
vscode-offline install-extensions --installer ./vscode-offline-installer
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
28
28
|
commit_id: COMMIT_ID
|
29
29
|
__commit_id__: COMMIT_ID
|
30
30
|
|
31
|
-
__version__ = version = '0.1.
|
32
|
-
__version_tuple__ = version_tuple = (0, 1,
|
31
|
+
__version__ = version = '0.1.8'
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 8)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -37,7 +37,7 @@ def cmd_download_server(args: Namespace) -> None:
|
|
37
37
|
|
38
38
|
download_vscode_server(
|
39
39
|
args.code_version,
|
40
|
-
output=args.installer /
|
40
|
+
output=args.installer / args.code_version.replace(":", "-"),
|
41
41
|
platform=get_server_platform(args.platform),
|
42
42
|
)
|
43
43
|
extensions_config = Path(args.extensions_config).expanduser()
|
@@ -63,7 +63,7 @@ def cmd_install_server(args: Namespace) -> None:
|
|
63
63
|
) from None
|
64
64
|
|
65
65
|
vscode_server_home = install_vscode_server(
|
66
|
-
server_installer=args.installer /
|
66
|
+
server_installer=args.installer / args.code_version.replace(":", "-"),
|
67
67
|
platform=get_server_platform(host_platform),
|
68
68
|
)
|
69
69
|
install_vscode_extensions(
|
@@ -104,7 +104,7 @@ def cmd_download_client(args: Namespace) -> None:
|
|
104
104
|
|
105
105
|
download_vscode_client(
|
106
106
|
args.code_version,
|
107
|
-
output=args.installer /
|
107
|
+
output=args.installer / args.code_version.replace(":", "-"),
|
108
108
|
platform=get_client_platform(args.platform),
|
109
109
|
)
|
110
110
|
extensions_config = Path(args.extensions_config).expanduser()
|
@@ -127,12 +127,12 @@ def cmd_download_all(args: Namespace) -> None:
|
|
127
127
|
|
128
128
|
download_vscode_server(
|
129
129
|
args.code_version,
|
130
|
-
output=args.installer /
|
130
|
+
output=args.installer / args.code_version.replace(":", "-"),
|
131
131
|
platform=get_server_platform(args.server_platform),
|
132
132
|
)
|
133
133
|
download_vscode_client(
|
134
134
|
args.code_version,
|
135
|
-
output=args.installer /
|
135
|
+
output=args.installer / args.code_version.replace(":", "-"),
|
136
136
|
platform=get_client_platform(args.client_platform),
|
137
137
|
)
|
138
138
|
extensions_config = Path(args.extensions_config).expanduser()
|
@@ -4,7 +4,6 @@ import json
|
|
4
4
|
import os
|
5
5
|
from collections.abc import Set as AbstractSet
|
6
6
|
from gzip import GzipFile
|
7
|
-
from io import DEFAULT_BUFFER_SIZE
|
8
7
|
from pathlib import Path
|
9
8
|
from urllib.error import HTTPError
|
10
9
|
from urllib.request import urlopen
|
@@ -12,6 +11,8 @@ from urllib.request import urlopen
|
|
12
11
|
from vscode_offline.loggers import logger
|
13
12
|
from vscode_offline.utils import extract_filename_from_headers, get_cli_platform
|
14
13
|
|
14
|
+
_DOWNLOAD_CHUNK_SIZE = 4 * 1024 * 1024 # 4 MiB
|
15
|
+
|
15
16
|
|
16
17
|
def _download_file_once(
|
17
18
|
url: str,
|
@@ -45,7 +46,7 @@ def _download_file_once(
|
|
45
46
|
tmp_file_path = Path(directory).joinpath(f"{filename}.tmp")
|
46
47
|
with reader, tmp_file_path.open("wb") as fp:
|
47
48
|
while True:
|
48
|
-
chunk = reader.read(
|
49
|
+
chunk = reader.read(_DOWNLOAD_CHUNK_SIZE)
|
49
50
|
if not chunk:
|
50
51
|
break
|
51
52
|
fp.write(chunk)
|
@@ -38,9 +38,7 @@ def get_vscode_extensions_config() -> os.PathLike[str]:
|
|
38
38
|
def get_vscode_version_from_server_installer(
|
39
39
|
installer: os.PathLike[str], platform: str
|
40
40
|
) -> str:
|
41
|
-
directories = list(
|
42
|
-
Path(installer).glob(f"server-*/vscode-server-{platform}.tar.gz")
|
43
|
-
)
|
41
|
+
directories = list(Path(installer).glob(f"*/vscode-server-{platform}.tar.gz"))
|
44
42
|
if len(directories) > 1:
|
45
43
|
raise ValueError(
|
46
44
|
f"Multiple matching installers found in {installer} for platform {platform}"
|
@@ -50,9 +48,9 @@ def get_vscode_version_from_server_installer(
|
|
50
48
|
f"No matching installer found in {installer} for platform {platform}"
|
51
49
|
)
|
52
50
|
|
53
|
-
version = directories[0].parent.name
|
51
|
+
version = directories[0].parent.name
|
54
52
|
logger.info(f"Getting version from {platform} installer: {version}")
|
55
|
-
return version
|
53
|
+
return version.replace("commit-", "commit:")
|
56
54
|
|
57
55
|
|
58
56
|
def get_default_code_version() -> str | None:
|
@@ -1,4 +1,12 @@
|
|
1
|
-
|
1
|
+
import tempfile
|
2
|
+
from pathlib import Path
|
3
|
+
|
4
|
+
import pytest
|
5
|
+
|
6
|
+
from vscode_offline.utils import (
|
7
|
+
extract_filename_from_headers,
|
8
|
+
get_vscode_version_from_server_installer,
|
9
|
+
)
|
2
10
|
|
3
11
|
|
4
12
|
def test_extract_filename_from_headers() -> None:
|
@@ -46,3 +54,36 @@ def test_get_filename_from_vsix_download_response() -> None:
|
|
46
54
|
extract_filename_from_headers(headers)
|
47
55
|
== "yzhang.markdown-all-in-one-3.6.3.vsix"
|
48
56
|
)
|
57
|
+
|
58
|
+
|
59
|
+
def test_get_vscode_version_from_server_installer_success() -> None:
|
60
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
61
|
+
base = Path(tmpdir)
|
62
|
+
version_dir = base / "commit-1234567890abcdef"
|
63
|
+
version_dir.mkdir()
|
64
|
+
(version_dir / "vscode-server-linux-x64.tar.gz").touch()
|
65
|
+
result = get_vscode_version_from_server_installer(base, "linux-x64")
|
66
|
+
assert result == "commit:1234567890abcdef"
|
67
|
+
|
68
|
+
|
69
|
+
def test_get_vscode_version_from_server_installer_multiple_found() -> None:
|
70
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
71
|
+
base = Path(tmpdir)
|
72
|
+
v1 = base / "commit-1111111111111111"
|
73
|
+
v2 = base / "commit-2222222222222222"
|
74
|
+
v1.mkdir()
|
75
|
+
v2.mkdir()
|
76
|
+
(v1 / "vscode-server-linux-x64.tar.gz").touch()
|
77
|
+
(v2 / "vscode-server-linux-x64.tar.gz").touch()
|
78
|
+
with pytest.raises(ValueError, match="Multiple matching installers found"):
|
79
|
+
get_vscode_version_from_server_installer(base, "linux-x64")
|
80
|
+
|
81
|
+
|
82
|
+
def test_get_vscode_version_from_server_installer_none_found() -> None:
|
83
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
84
|
+
base = Path(tmpdir)
|
85
|
+
version_dir = base / "commit-1234567890abcdef"
|
86
|
+
version_dir.mkdir()
|
87
|
+
(version_dir / "vscode-server-linux-arm64.tar.gz").touch()
|
88
|
+
with pytest.raises(ValueError, match="No matching installer found"):
|
89
|
+
get_vscode_version_from_server_installer(base, "linux-x64")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|